Gracefully handle POST requests with nil bodies
This commit is contained in:
parent
580029954f
commit
91af9ad19a
1 changed files with 1 additions and 1 deletions
|
|
@ -162,7 +162,7 @@ module MCP
|
|||
|
||||
def parse_request_body(body_string)
|
||||
JSON.parse(body_string)
|
||||
rescue JSON::ParserError
|
||||
rescue JSON::ParserError, TypeError
|
||||
[400, { "Content-Type" => "application/json" }, [{ error: "Invalid JSON" }.to_json]]
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue