Skip to content

Commit

Permalink
Merge pull request #90 from guzba/ryan
Browse files Browse the repository at this point in the history
0.3.3
  • Loading branch information
guzba authored Aug 18, 2023
2 parents ea4824b + e7c064c commit fbb814b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion mummy.nimble
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = "0.3.2"
version = "0.3.3"
author = "Ryan Oldenburg"
description = "Multithreaded HTTP + WebSocket server"
license = "MIT"
Expand Down
12 changes: 11 additions & 1 deletion src/mummy/multipart.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit fbb814b

Please sign in to comment.