Domain Error = NSPOSIXErrorDomain Code = 100 "Protocol Error"

I am trying to call a service using Alamofire using the .get method. There is nothing special in the request, except for the parameters, only the authorization header.

I'm a little confused because the request works fine when I run it on the mail carrier with the same URL and authorization token, but when I run my application code using Alamofire, it returns this error:

Domain Error = NSPOSIXErrorDomain Code = 100 "Protocol Error" UserInfo = {NSErrorPeerAddressKey = {length = 16, capacity = 16, bytes = 0x100201bbd83ad0b10000000000000000}, _kCFStreamErrorCodeKey = 100, _kCFStreamErrorDomainKey =

I use:

Alamofire.request("https://myserverURL", method: .get, parameters: [:], encoding: JSONEncoding.default, headers: ["Authorization":"myToken"])
        .responseJSON {response in 

    guard response.result.error == nil else { 
       //HERE IS WHERE IS GOING IN WITH THE ERROR
    }
}

Any thoughts would be greatly appreciated or call me in the right direction :)

+14
10

, , Cocoa URLSession. HTTP.

HTTP-/, , - . , Content-Length Content-Type ? , () , (, , , ..).

URLRequest.addValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type"), Content-Type HTTP.

macOS 10.12, 12.11, , HTTP- .

, .


, , encoding: JSONEncoding.default . HTTP GET , / / .

Accept: application/json , , .

+9

, Apache upgrade. Apache bugzilla .

, Header unset Upgrade Apache.

+5

, , . , , , HTTP .

IIS API IIS, 10, HTTP 2.0, , . , SSL- API , , HTTP 2.0. HTTP 2.0 IIS API .

, - , , , Charles HTTP.

, - .

+3

: [:] : nil . .

+2

["Content-Type": "application/json"] .

+1

, , feild nil ""

[request setValue: @"" forHTTPHeaderField:@"Authorization"];

[request setValue: nil forHTTPHeaderField:@"Authorization"];
+1

F5. F5 , json, @/, . , , - F5, .

0

- , . . , ( ). 500 "EOF" xCode. . . , iOS.

0

, Google Places API, , HTTP, HTTP nil, .

0

Source: https://habr.com/ru/post/1665715/


All Articles