fix(gitlab): don't set Content-Type header when uploading release assets #1183
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.
As noted in a comment on #1172, switching to the use of the native fetch API broke uploading release assets to GitLab by hard-coding the Content-Type header to "text/plain". The recommended approach is to avoid setting the Content-Type header at all and let the fetch API implementation set it so as to ensure that the correct boundary expression is included.
Add a flag to theUpdate therequest
function to allow explicitly disabling setting the Content-Type header.request
function to avoid setting the Content-Type header if the body is an instance ofFormData
. The default behaviour is to set the header as before but we disable setting the header only in theuploadAsset
function.The bug is blocking a feature in our product and I've checked that the change in this PR fixes our observed issue with GitLab release asset uploads. Using the branch from this PR, I am able to create a release with the expected assets in a test project.
Closes #1172