Replies: 3 comments 4 replies
-
This is being added by Next.js’ internal serverside fetch API, which operates differently than the spec fetch API. MY guess is that it’s being added after openapi-fetch runs (openapi-fetch basically hands off the request to Next.js), but to confirm you could add openapi-fetch middleware that just logs the Request (middleware is the last thing to touch thr Request in this library). Beyond that I don’t work with Next.js enough to know how to change this behavior |
Beta Was this translation helpful? Give feedback.
-
Hello @drwpow and thank you for your quick assistance! That sounds strange cause meanwhile I don't resolve this problem with openapi-fetch, I'm using the regular-native fetch and the requests are normal. This is the code I'm using:
And the RAW request is not chunked:
I added the middleware also to openapi-fetch, and this is what it carries:
If the problem is related with NextJS, I don't understand why it does only fail when I'm using the library :/ Thank you |
Beta Was this translation helpful? Give feedback.
-
@narnau I have the same stack as you (Nextjs, Django/DRF API, openapi-fetch), and the following configurations seems to do the trick for me:
|
Beta Was this translation helpful? Give feedback.
-
Hi,
I'm currently using openapi-fetch in a Next.js action (server-side) to handle my API requests. However, when I make POST or PUT requests, the requests are automatically being sent with Transfer-Encoding: chunked. This is causing issues with my backend (Django), as it doesn't handle chunked requests properly.
Here is an example of the raw request:
In this case, the Transfer-Encoding: chunked is automatically applied, even though I'm passing the full payload at once. This behavior seems to be causing issues on the Django backend.
My Question: Is there a way to configure openapi-fetch so that it doesn't use Transfer-Encoding: chunked and sends the request with a Content-Length header instead?
Any guidance on how to resolve this would be greatly appreciated!
Additional Info:
Environment: Running this in a Next.js action (server-side)
Backend: Django, which is having issues with chunked requests
Thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions