Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save marcobehlerjetbrains/75f5e082f07def8957fc0234076f7435 to your computer and use it in GitHub Desktop.

Select an option

Save marcobehlerjetbrains/75f5e082f07def8957fc0234076f7435 to your computer and use it in GitHub Desktop.
Spring Boot REF1 - Http Delete
(async function deletePhoto(id) {
await fetch("http://localhost:8080/photoz/" + id, {
method: "DELETE"
})
})("5")
@FilipeanSilva

Copy link
Copy Markdown
   DELETE http://localhost:8080/photoz/1 405 (Method Not Allowed)

ghost commented Oct 15, 2024

Copy link
Copy Markdown

good shit :D

@Amine1987

Amine1987 commented Jun 30, 2025 •

Copy link
Copy Markdown

@FilipeanSilva i got the same error using Postman with my url customized :

http://localhost:8080/photos/1

The JSON response pop up a 405

image

Don't know what to do

@Sijia324

Sijia324 commented Feb 4, 2026 •

Copy link
Copy Markdown
  1. run in http://localhost:8080/, instead of endpoints.
    2.For the first parameter in await fetch (), use relative path instead of whole path .
    (async function deletePhoto(id) {
    const response = await fetch('/photoz/' + id, { // Relative URL
    method: 'DELETE'
    });
    console.log(response.status); // Should show 404 or 405
    })("5");

I tested it works. After running the async code, check /photoz, you will see the key pair value is gone.

EDIT: Try original code on Chrome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment