Hey there! I'm trying to figure out how to access the response header after making a POST request. I've been using console.log(response)
to see what's inside the response
object, and while I can retrieve the response body from responseData
, I'm struggling to find a way to access the header as well. Can someone please provide guidance on how to retrieve both the header and body of the response? Thanks so much!
Below is an example of my current approach:
fetch(URL_REGISTER, {
method: 'POST',
body: formData
})
.then((response) => response.json())
.then((responseData) => {
if(responseData.success == 1){
this.setState({
message1: responseData.msg,
});
}
else{
this.setState({
message1: responseData.msg,
});
}
})
.done();
},