Skip to content

Instantly share code, notes, and snippets.

@marcobehlerjetbrains
Last active February 4, 2026 23:12
Show Gist options
  • Select an option

  • Save marcobehlerjetbrains/3b9ed46953f810160e3a47e81f88e027 to your computer and use it in GitHub Desktop.

Select an option

Save marcobehlerjetbrains/3b9ed46953f810160e3a47e81f88e027 to your computer and use it in GitHub Desktop.
Spring Boot REF2 - Http Post
(async function createPhoto() {
let photo = {"fileName": "hello.jpg"};
await fetch("http://localhost:8080/photoz", {
method: "POST",
headers: {
"Accept": "application/json",
"Content-Type": "application/json"
},
body: JSON.stringify(photo)
})
.then(result => result.text())
.then(text => alert(text));
})();
@Sijia324

Sijia324 commented Feb 4, 2026

Copy link
Copy Markdown

run it in http://localhost:8080
it will work.

@Sijia324

Sijia324 commented Feb 4, 2026

Copy link
Copy Markdown

Try original code in Chrome.

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