We have a REST API which maps third-party proprietary language codes (in the en-US
format) into language codes that our own system recognises. The REST API's route is
~/v1/languages/mappings/{foreignLanguageCode} [GET]
We receive these third-party language codes and send them to our own API using an instance of System.Net.Http.HttpClient
.
This is working perfectly well for many language codes but when passed ko-US
the request doesn't even get sent - the HttpClient object throws the exception
An error occurred while sending the request.
The inner exception - a WebException
- says
The server committed a protocol violation. Section=ResponseStatusLine
The exception also contains
Source: "System"
Status: ServerProtocolViolation
StackTrace:
at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
at System.Net.Http.HttpClientHandler.GetResponseCallback(IAsyncResult ar)
The URI at this point is
https://www.example.com/api/v1/languages/mappings/ko-US/
I've tried it with and without that trailing slash: no difference. We can send many other language codes to the same API without any problem.
Can anyone explain why this particular URI causes this exception?