Closed paulboocock closed 2 years ago
The .addHeader
call on line 135 was .addHeader("Content-Type", Constants.POST_CONTENT_TYPE)
originally, up until this bug fix #195. I'm not sure why that particular change - "Content-Type"
to HttpHeaders.CONTENT_TYPE
was made.
Edit: technically the first version was .addHeader("Content-Type", "application/json; charset=utf-8")
The
.addHeader
call on line 135 was.addHeader("Content-Type", Constants.POST_CONTENT_TYPE)
originally, up until this bug fix #195. I'm not sure why that particular change -"Content-Type"
toHttpHeaders.CONTENT_TYPE
was made.Edit: technically the first version was
.addHeader("Content-Type", "application/json; charset=utf-8")
I'm not sure why I did it either. I think I likely just copy and pasted and my IDE auto imported it. Either way, going back to the string is the correct call.
Describe the bug We still import in org.apache.http.HttpHeaders within OkHttpClientAdapter, however OkHttp no longer imports HttpClient like it used to (a long time ago!).
https://github.com/snowplow/snowplow-java-tracker/blob/d60f3f75b9efbbca7310876f7e9f17d394d4540a/src/main/java/com/snowplowanalytics/snowplow/tracker/http/OkHttpClientAdapter.java#L29-L29
We don't actually need to use this import, we can just use the string values for the HttpHeader values.
https://github.com/snowplow/snowplow-java-tracker/blob/d60f3f75b9efbbca7310876f7e9f17d394d4540a/src/main/java/com/snowplowanalytics/snowplow/tracker/http/OkHttpClientAdapter.java#L134-L134