/    Sign up×
Community /Pin to ProfileBookmark

fetch changes method automatically from PUT to OPTIONS?

Here is my fetch:
https://jsfiddle.net/bsezdhfc/3/

And here is the log on the server
[url=https://postimages.org/][img]https://i.postimg.cc/8km6bVVN/logg.png[/img][/url]

Why the * does the method change from PUT to OPTIONS? Resulting in an error, as there is no routine for OPTIONS.

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@sibertauthorJul 15.2022 — ["fetch changes from PUT to OPTIONS?","fetch changes method automatically from PUT to OPTIONS?"]
Copy linkTweet thisAlerts:
@sibertauthorJul 16.2022 — Method OPTIONS (handshake sort of) is always sent before method PUT to verify it is OK to proceed.

I am not sure if it was this that helped, but now it is working. I added this to the API server:

w.Header().Set("Access-Control-Allow-Credentials", "true");
×

Success!

Help @sibert spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 4.27,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...