DEV Community

loading...

Discussion on: POST request in redux-saga not working

Collapse
saiavinashiitr profile image
Sai Avinash Duddupudi Author • Edited

Update :- The 400 Bad request has gone away after I added "Content-Type": "application/x-www-form-urlencoded" in the headers and changed the body type accordingly

Example :-

fetch("api/xxx", {
    body: "email=test@example.com&password=pw",
    headers: {
        "Content-Type": "application/x-www-form-urlencoded",
    },
    method: "post",
}
Enter fullscreen mode Exit fullscreen mode