Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Ref sbt/ivy#40
Fixes #5483
from Set explicit HTTP Accept header to avoid text/html
By default,
java.net.HttpURLConnection
HTTPAccept
header is set totext/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
This leads to Microsoft servers responding with a 203 status code and an HTML pages when uploading or downloading artifacts to Azure Artifacts.
Given that Maven also have a similar issue (
text/html
as the preferred response content-type), Microsoft has implemented a workaround that ignores theAccept
header values whenUser-Agent
isApache Maven/*
. However, this workaround is not implemented on their side for SBT.This pull request sets HTTP
Accept
header toapplication/octet-stream, application/json, application/xml, */*
to fix this behavior, as evidenced here:https://dev.azure.com/aironek/sbt-test/_build/results?buildId=43&view=logs&j=12f1170f-54f2-53f3-20dd-22fc7dff55f9&t=b60649db-91ed-45ce-b0dd-c9633ee87772
Given that the last component is
*/*
, this shoud be backward-compatible with other serivces (Nexus, Artifactory, etc) that reply with different content-types.