https://cypress.io logo
How to Set Content-type as Json in Cy.Request for ...
# i-need-help
i
I Tried to call Cy.Request for Post API and i tried to send my Header as 'Content-Type': 'application/json; charset=utf-8' but in the request its sending "content-type": "application/x-www-form-urlencoded", something is overriding this so can any one help me how to set content-type Note: for Get its working fine Error im getting is
¯\_(ツ)_/¯
I found the solution as by adding the 2 things in cy.request which is mareked in the image below
e
That seems odd. Did you check the request headers to ensure that
content-type
was getting set? I wouldn't think
;
would work there.
i
Yes i checked it in the response it was showing. request header information too and i found it was set as required.