Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,152,320 members, 7,815,622 topics. Date: Thursday, 02 May 2024 at 03:25 PM |
Nairaland Forum / Science/Technology / Programming / Why Is The Browser Messing With My Headers (402 Views)
Google Chrome Or Apple Safari? Which Browser Is Better / Please Help My Android Studio Is Messing Up / Help ! Json Data Displays On Browser But Returns Error (500) Via Httpurlconn (2) (3) (4)
Why Is The Browser Messing With My Headers by chukwuebuka65(m): 10:01pm On Aug 19, 2023 |
I have an endpoint that receives “content-type” of “application/json” but when I hit it from javascript, it returns a 415 unsupported media type status code. But When I use postman it works. So I inspected the network tab of dev tools and discovered the request headers content type is text/plain instead of the application/json I set it to be. Why is this happening ? |
Re: Why Is The Browser Messing With My Headers by Paystack: 10:47pm On Aug 19, 2023 |
chukwuebuka65: This is why ChatGpt was created |
Re: Why Is The Browser Messing With My Headers by chukwuebuka65(m): 11:14pm On Aug 19, 2023 |
Paystack: In as much as chatgpt is useful, its still not a human being. I actually got the answer i am looking for on stackoverflow as chatgpt couldnt help me. |
Re: Why Is The Browser Messing With My Headers by Paystack: 11:42pm On Aug 19, 2023 |
chukwuebuka65: It provides better help and faster help than humans as at now. 1 Like |
Re: Why Is The Browser Messing With My Headers by Davidcorny: 2:23am On Aug 20, 2023 |
chukwuebuka65:Your path to the file is wrong. Target your files properly. |
Re: Why Is The Browser Messing With My Headers by stanliwise(m): 10:25am On Aug 20, 2023 |
chukwuebuka65:Set the content-type in JS. It’s most likely never the browser |
Re: Why Is The Browser Messing With My Headers by Luckydonalds(m): 4:03pm On Aug 20, 2023 |
stanliwise:OP, this is the answer you are lookin for here. Set the content type in your headers before sending the request 1 Like |
Re: Why Is The Browser Messing With My Headers by chukwuebuka65(m): 6:39pm On Aug 20, 2023 |
Luckydonalds:I have found the solution. |
Re: Why Is The Browser Messing With My Headers by chukwuebuka65(m): 6:40pm On Aug 20, 2023 |
stanliwise: I have found the solution. |
Re: Why Is The Browser Messing With My Headers by stanliwise(m): 6:43pm On Aug 20, 2023 |
chukwuebuka65:You can as well talk about the solution just so someone stumble on this thread in future |
Re: Why Is The Browser Messing With My Headers by Paystack: 8:39pm On Aug 20, 2023 |
stanliwise: You're wise 1 Like |
Re: Why Is The Browser Messing With My Headers by chukwuebuka65(m): 9:47pm On Aug 20, 2023 |
stanliwise: It has to do with cors. I was getting cors error, so I added “no cors” to the fetch mode configuration to bypass the error . But with that configuration, the browser does not allow any other value for the “content-type” header expect “text/plain”. So I contacted the backend team and we were able to rectify it. |
(1) (Reply)
. / Website Short Links To Get Started With Programming / Hybrid App Development Vs Native App Development – Which Is The Best For Your Bu
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 16 |