-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
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
Issue while using FormData in httpRequest method #62
Comments
The const data = {};
formData.forEach((value, key)=> {
data[key] = value;
}); |
Thanks @thivi. The requirement was to send the payload as Form Data to the backend REST API layer as some of the APIs expect the payload in that format. Anyway as a workaround, we could add the following header to the request to convert the payload type to form data.
Thanks! |
This particular backend REST API only accepts content type of @thivi Appreciate if you could consider supporting this requirement in the SDK level |
A solution to this was implemented by asgardeo/asgardeo-auth-spa-sdk#60 and #63. Example: httpRequest({
url: "https://localhost:5000",
method: "POST",
data: { key: "value" },
shouldEncodeToFormData: true
}).then((response) => {
console.log(response);
}); |
The above resolves our issue. Thanks @thivi for the prompt solution. |
Describe the issue:
An error gets thrown when we try to use the
FormData()
object to attach the data in Form Data format to a PUT request in the httpRequest method.How to reproduce:
Asgardeo React SDK version :
"@asgardeo/auth-react": "^0.2.6",
Sample code:
Error:
Expected behavior:
Environment information (Please complete the following information; remove any unnecessary fields) :
Optional Fields
Related issues:
Suggested labels:
The text was updated successfully, but these errors were encountered: