score:1
Accepted answer
since the data is json-encoded, you need to use the correct content type in your request:
headers: {
'content-type': 'application/json',
}
or, even easier, let axios take care of it (because it defaults to json):
const config: axiosrequestconfig = {
method: 'post',
url: url,
data: {
username: e.target[0].value,
email: e.target[1].value,
password: e.target[2].value
}
}
Source: stackoverflow.com
Related Query
- Expecting to get client sides' username by calling `req.body.username`. However, calling `req.body` returns a weird formatted String
- React open mailto E-Mail client onClick with body from textarea
- How to send body data and headers with axios get request?
- how to get the ip address of the client from server side in next.js app?
- How to get response body and response headers in one block
- FirebaseError: Failed to get document because the client is offline
- Use Auth0's hook useAuth0 to get token and set header in Apollo client
- Get Message From Kafka, send to Rsocket and Receive it from React client
- How can i get a client side cookie with next.js?
- Why didn't the client folder from my project get uploaded on gitHub?
- getting Network Error when calling axios get request in react js
- How to make AJAX GET request on the client to external site with React
- Get image from server and preview it on client
- Calling mongoose from react client side
- Calling a graphQL query from within react client
- React apollo client api calling two time
- React Webpack. Why do I get an error when calling a function from a child component?
- How to get get username (or any other data) of the logged in user with React/Redux
- How to set username and password in axios get method header
- Sending Request body for GET method in AXIOS throws error
- how to I get a user's IP address when separate client and server apps, in Node with Nest.js
- React Hooks Calling GET Request On Modal Popup
- browser says " request has been blocked by CORS policy" when calling to a spring boot get method from react js using axios
- Make a GET request from within a Node.JS server app and send it to React.JS client
- How do I get rid of the white spaces on both sides of an image?
- Trying to send data in the body of a Axios GET to use in Django backend, but print of request.body is empty
- How to get full response instead of just body using await in reactJS
- Get updated state of component when calling method on class via enzyme
- Session returns null Get request however in Post returns the session correctly in Next.js in server side (nextAuth)
- Karma - Jquery: How to Get Client Side Jquery Code to Work in Karma Tests?
More Query from same tag
- How to pass object from parent to child class
- How to update one item without affecting other arguments?
- Uncaught TypeError: Cannot read property 'append' of null in typescript
- Using React.js statics inside class methods
- Reactjs - Move to next page after login
- Refresh input to change value ReactJS
- How to access the div element with class and attach the popup to it using react?
- How to make react-select always display the option list
- Dispatch an action from container
- react router not getting route after click
- Including headers and data array in Return Statement with Node.js
- Accessing Bootstrap method from inside React app
- React.js search bar always fetches the same content
- why checking for undefined from a function call causes SSR error, but not directly using `typeof` in react?
- Socket.io-client does not connect in React.js
- Redux-Saga failing error handling tests using Generator.prototype.next()
- adding multiple states in context provider with react hooks
- A react `useReducer` with some dependencies
- Warning: Failed prop type: Invalid prop `children` supplied to `MenuItem`, expected a ReactNode
- How to get reducer unit test working?
- Make a button clickable inside a drawer?
- State is getting logged as undefined
- FieldArray component does not work
- How to make sidebar using framework in reactjs?
- Can't get NextJS ConfettiExplosion to work: Invalid Hook Call
- React Hooks - set state to initial state
- fireEvent.change does not toggle checkbox
- How to type interdependent Props in typescript 3.8?
- After redirecting route to 'thank-you' component, I want the user to be able to hit browser back button to go back to home
- Ant.design does not detect custom input component in Form.Item React