We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
body
beforeRequest
When replacing body in beforeRequest hook with a data that contains Unicode characters, an error may occur.
https://codesandbox.io/p/sandbox/hungry-dew-gd283f?file=%2Fapp%2Fpage.tsx%3A18%2C13-18%2C69
got .post("domain.api", { hooks: { beforeRequest: [ (options) => { const newJsonBody = { ...options.json, new_field: "new_field", }; // Original: not working options.body = JSON.stringify(newJsonBody); // Fixed // options.body = Buffer.from(JSON.stringify(newJsonBody)); options.headers["content-length"] = options.body.length.toString(); }, ], }, json: { city: "Hà Nội", // Unicode characters }, })
I found a solution by using a Buffer instead. It may be useful to update the documentation to reflect this approach.
Buffer
The text was updated successfully, but these errors were encountered:
v11 is no longer supported.
Sorry, something went wrong.
No branches or pull requests
Describe the bug
body
afterbeforeRequest
#1453Actual behavior
When replacing
body
inbeforeRequest
hook with a data that contains Unicode characters, an error may occur.Code to reproduce
https://codesandbox.io/p/sandbox/hungry-dew-gd283f?file=%2Fapp%2Fpage.tsx%3A18%2C13-18%2C69
Solutions
I found a solution by using a
Buffer
instead. It may be useful to update the documentation to reflect this approach.Checklist
The text was updated successfully, but these errors were encountered: