Fix non-alg mode content-type handling #223
Merged
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.
Issue #, if available:
Internal high escalations
Description of changes:
Content-type handling of default_input_fn (for non-algorithm mode) currently has a brittle implementation that does not accept more sophisticated content-type formats. Content formats are well defined https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Type and can have parameters after a semicolon. Currently, this container can support loading of csv files, where it will convert csv files into an xgboost dmatrix as long as the supplied content-type is 'text/csv'. However, it will throw an UnsupportedFormatError if passed 'text/csv; charset=UTF-8', which is incorrect as this should be supported. This change correctly accepts this case and opens the door to parsing/handling those additional parameters if needed in the future. Note that in the case of csv and UTF-8, python3 already handles the UTF-8 case with no other changes needed.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.