Created
March 23, 2022 10:14
-
-
Save marcobehlerjetbrains/75f5e082f07def8957fc0234076f7435 to your computer and use it in GitHub Desktop.
Spring Boot REF1 - Http Delete
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (async function deletePhoto(id) { | |
| await fetch("http://localhost:8080/photoz/" + id, { | |
| method: "DELETE" | |
| }) | |
| })("5") |
FilipeanSilva
commented
Jun 10, 2024
good shit :D
@FilipeanSilva i got the same error using Postman with my url customized :
http://localhost:8080/photos/1
The JSON response pop up a 405
Don't know what to do
- 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
