4nth0 / golem

From a single config file Golem start a mock server

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Handle Method Not Allowed

4nth0 opened this issue · comments

Golem send the wrong status code when we call it with an unallowed HTTP method

port: "8989"
services:
  - name: "Service Sample"
    http_config:
      routes:
        "/foo":
          body: "bar"

If I try to call the service with an unallowed method I have a 200 Ok status code instead of 405 Method Not Allowed

curl -X POST http://127.0.0.1:8989/foo

*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to 127.0.0.1 (127.0.0.1) port 8989 (#0)
> POST /foo HTTP/1.1
> Host: 127.0.0.1:8989
> User-Agent: curl/7.64.1
> Accept: */*
> 
< HTTP/1.1 200 OK
< Date: Fri, 25 Jun 2021 14:24:35 GMT
< Content-Length: 2
< Content-Type: text/plain; charset=utf-8
< 
* Connection #0 to host 127.0.0.1 left intact
Io* Closing connection 0