Why does request.allHTTPHeaderFields work when request.addValue and request.setValue both fail?

Viewed 89

I have been writing some code to make a call to an API that requires a key and secret key. I had been trying to set these keys in the header of URLRequest with .addValue and .setValue, but either way I got a response from the API that indicated that no keys had been set at all. However, when I use .allHTTPHeaderFields it just works no problem. I am curious why .addValue and .setValue both fail here...

0 Answers
Related