ios - Swift 3 - Rest Api HTTP Header Values are not being sent -


i'm trying build app swift, makes rest api call authorization header. code looks this:

var request = urlrequest(url: url!)     request.httpmethod = "get"     request.addvalue("application/json", forhttpheaderfield: "content-type")     request.addvalue("application/json", forhttpheaderfield: "accept")     request.addvalue("username:password", forhttpheaderfield: "authorization")     request.addvalue("de", forhttpheaderfield: "content-language")      urlsession.shared.datatask(with: request) { (data, response, error) in      ...      ... 

my problem http header values somehow not being sent. verified requests values being set printing out request.allhttpheaderfields, response server still holds default values headers. not authorization header other header try change.

it great if can find mistake... mean, simple piece of code, i'm confused went wrong.


Comments

Popular posts from this blog

cookies - Yii2 Advanced - Share session between frontend and mainsite (duplicate of frontend for www) -

angular - password and confirm password field validation angular2 reactive forms -

php - Permission denied. Laravel linux server -