ywxzm03 opened a new pull request, #154:
URL: https://github.com/apache/dubbo-go-pixiu-samples/pull/154
**What this PR does**:
Fixes an issue in the `http/simple` sample where invalid requests could be
treated as successful requests:
- When `POST /user/` receives an invalid JSON request body, it now returns
`400 Bad Request` immediately and stops further processing, avoiding writing a
zero-value `User{Name:""}` into the cache.
- Adds a fallback branch for unsupported HTTP methods in the `/user/`
handler, so unsupported methods such as `PUT` and `DELETE` return `405 Method
Not Allowed` instead of the default `200 OK` empty response.
- Adds negative tests in `http/simple/test/pixiu_test.go` for invalid JSON,
`PUT`, and `DELETE` scenarios to prevent regressions such as `2xx + error body`
or `2xx + empty body`.
**Which issue(s) this PR fixes**:
Fixes #144
**Special notes for your reviewer**:
This PR only updates error handling and related tests for the `http/simple`
sample. It does not change the successful `POST /user/` or `GET /user/{name}`
behavior.
**Does this PR introduce a user-facing change?**:
```release-note
None
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]