My fetch call is being rewritten to remove POST method
Unanswered
southclaws posted this in #help-forum
Hi, not sure if this is a bug or some undocumented behaviour but I'm observing a fetch call in my codebase with a very explicit
Next.js seems to be doing something wrong here, perhaps related to the hooking/messing with
method: "POST" hitting the server with a method of GET.Next.js seems to be doing something wrong here, perhaps related to the hooking/messing with
fetch on server components.15 Replies
The call is being made in an async page component, could this be why?
export default async function Page({ params }: Props) {If so, I'd much prefer an error rather than silent messing with expected results
if not, seems like. a pretty seirous bug
@southclaws Hi, not sure if this is a bug or some undocumented behaviour but I'm observing a fetch call in my codebase with a very explicit `method: "POST"` hitting the server with a method of GET.
Next.js seems to be doing something wrong here, perhaps related to the hooking/messing with `fetch` on server components.
Is there any redirection going on? Iirc 301/302 may change the method to GET while 307/308 preserves the method
This is definitely not normal, nextjs is not known to mess with request methods randomly like this
No, this is pure localhost to localhost
the server is also not doing anything, I'm viewing the debugger right now, right after TCP+HTTP processing, the method is definitely coming in as a GET
pre-middleware
Hmm then I have no ideas, sorry. In my apps POSTs are still POSTs as usual, nothing is wrong
weird, I guess time to nuke Nextjs and reinstall lol
it could be a bug with the cache, I've set it to not cache but it might have remembered a failed request and is repeatedly sending that
(cache should not ever record a failed response but bugs happen...)
Thanks for the response anyway!