0

I am trying to send a HTTP POST request and I am setting a value for the header field referer:

request.setValue("testRefererValue", forHTTPHeaderField: "referer")

But when the request is being hit the key value "referer" is being changed to "Referer" with a capital R automatically like below,

{"Referer": "testRefererValue"}

instead of:

{"referer": "testRefererValue"}

Backend developers who are receiving this request have written their code to parse key "referer" with small R and thus the request is failing.

Why is this happening? Is there a way to not make this happen? Thanks for the answers in advance.

Rohith S
  • 50
  • 6
  • 2
    Your backend devs need to properly parse headers / use a library for that so so they do not need to worry about it (and to prevent them from making mistakes). – luk2302 Jun 04 '21 at 08:35

0 Answers0