Skip to content

Commit ff30c0d

Browse files
committed
Hotfix for formMethod
1 parent 5892a14 commit ff30c0d

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

src/main/java/org/javawebstack/httpserver/Exchange.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -291,9 +291,12 @@ private HTTPMethod getRequestMethodFromSocket(IHTTPSocket socket) {
291291
if ("websocket".equalsIgnoreCase(socket.getRequestHeader("upgrade")))
292292
return HTTPMethod.WEBSOCKET;
293293
if (server.isFormMethods() && (socket.getRequestMethod() == HTTPMethod.GET || socket.getRequestMethod() == HTTPMethod.POST) && getMimeType() == MimeType.X_WWW_FORM_URLENCODED) {
294-
String rawMethodOverride = getBodyPathElement("_method").string();
295-
if (rawMethodOverride != null)
296-
return HTTPMethod.valueOf(rawMethodOverride);
294+
AbstractElement e = getBodyPathElement("_method");
295+
if (e != null) {
296+
try {
297+
return HTTPMethod.valueOf(e.string());
298+
} catch (IllegalArgumentException ignored) {}
299+
}
297300
}
298301
return socket.getRequestMethod();
299302
}

0 commit comments

Comments
 (0)