diff --git a/mummy.nimble b/mummy.nimble index 00449e3..d4fd5c7 100644 --- a/mummy.nimble +++ b/mummy.nimble @@ -1,4 +1,4 @@ -version = "0.3.2" +version = "0.3.3" author = "Ryan Oldenburg" description = "Multithreaded HTTP + WebSocket server" license = "MIT" diff --git a/src/mummy/multipart.nim b/src/mummy/multipart.nim index 578d92c..8270995 100644 --- a/src/mummy/multipart.nim +++ b/src/mummy/multipart.nim @@ -19,7 +19,17 @@ proc decodeMultipart*(request: Request): seq[MultipartEntry] {.raises: [MummyErr msg &= ", " & extra raise newException(MummyError, move msg) - let first = request.headers["Content-Type"].split(';', maxsplit = 1) + var contentType = request.headers["Content-Type"] + + # Wolfram HTTPClient in Wolfram Language uses a comma instead of + # a semicolon: multipart/form-data, boundary=vTd41rxm1e7O + if request.headers["User-Agent"].startsWith("Wolfram HTTPClient"): + contentType = contentType.replace( + "multipart/form-data,", + "multipart/form-data;" + ) + + let first = contentType.split(';', maxsplit = 1) if cmpIgnoreCase(first[0], "multipart/form-data") != 0 or first.len != 2: raiseInvalidContentType()