diff options
| author | DanielGavin <danielgavin5@hotmail.com> | 2025-05-29 00:37:06 +0200 |
|---|---|---|
| committer | DanielGavin <danielgavin5@hotmail.com> | 2025-05-29 00:37:06 +0200 |
| commit | 83dec1712fc5f62cfd4f3b0c0d093b483bf0742b (patch) | |
| tree | 8e017bb09eac1c8e7c29bc147f98a44a8468682b /src | |
| parent | 3cf5e4cf406bf7c1d67a5a71e7e7059b53aab59d (diff) | |
Check for when the method doesn't exist and send error with log.
Diffstat (limited to 'src')
| -rw-r--r-- | src/server/requests.odin | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/server/requests.odin b/src/server/requests.odin index 4832c9d..84bb405 100644 --- a/src/server/requests.odin +++ b/src/server/requests.odin @@ -322,7 +322,15 @@ cancel :: proc(value: json.Value, id: RequestId, writer: ^Writer, config: ^commo call :: proc(value: json.Value, id: RequestId, writer: ^Writer, config: ^common.Config) { root := value.(json.Object) - method := root["method"].(json.String) + + method, ok := root["method"].(json.String) + + if !ok { + log.errorf("Failed to find method: %#v", root) + response := make_response_message_error(id = id, error = ResponseError{code = .MethodNotFound, message = ""}) + send_error(response, writer) + return + } diff: time.Duration { |