uhttp: recognize application/soap+xml (SOAP 1.2) as XML content type#1037
uhttp: recognize application/soap+xml (SOAP 1.2) as XML content type#1037cvkramer wants to merge 2 commits into
Conversation
Add "application/soap+xml" to xmlContentTypes so IsXMLContentType correctly identifies SOAP 1.2 responses as XML. IsXMLContentType already does a prefix match on a lowercased/trimmed header, so suffixes like "; charset=utf-8" and '; action="..."' are tolerated without further changes. Add test cases covering application/soap+xml (bare and with charset plus action parameter), keep existing text/xml and application/xml cases passing, and confirm IsJSONContentType/IsXMLContentType still behave correctly for application/json. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ning - Convert TestHelpers_IsXMLContentType_Failure into a table-driven test covering empty/missing Content-Type, text/html, text/plain, and application/json, matching the style of the success table. - Harden IsXMLContentType to split the Content-Type on ';' and compare the base media type exactly, instead of a raw prefix match, so lookalike types (e.g. application/soap+xmlrpc, application/xmlfoo) are no longer misclassified as XML. - Add TestHelpers_IsXMLContentType_LookalikeBoundary to lock in the corrected boundary behavior as a regression test. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
General PR Review: uhttp: recognize application/soap+xml (SOAP 1.2) as XML content typeBlocking Issues: 0 | Suggestions: 1 | Threads Resolved: 0 Review SummaryFull PR diff scanned for security and correctness. This change adds Risk Triage
Security IssuesNone found. Correctness IssuesNone found. Suggestions
Prompt for AI agents |
Summary
Recognize
application/soap+xml(SOAP 1.2, RFC 3902) as an XML content type inpkg/uhttp, soWithGenericResponseauto-routes SOAP 1.2 responses to the XML parser. Also hardenIsXMLContentTypeto match the base media type exactly (splitting off;parameters) instead ofstrings.HasPrefix— this tolerates parameters like; charset=utf-8; action=...and fixes a pre-existing bug where lookalikes such asapplication/soap+xmlrpcwere misclassified as XML.Changes
pkg/uhttp/contenttype.go: addapplication/soap+xml; exact base-type comparison.Tests
pkg/uhttp/contenttype_test.go: positive (soap+xml, with charset/action params, text/xml, application/xml), negative (empty, text/html, text/plain, application/json), and lookalike-boundary cases.go test ./pkg/uhttp/...andgo build ./...pass.Validation
Exercised end-to-end against a live SOAP 1.2 server (
application/soap+xml): responses parsed and synced by baton-http.Part of CXH-2134. Resolves CXH-2135.