module
Version:
v0.0.0-...-cc47b7c
Opens a new window with list of versions in this module.
Published: Jan 10, 2024
License: MIT
Opens a new window with license information.
README
¶
issue 3141
kratos issue 3141 复现工程。
版本:
- kratos: v2.7.2
- protoc-gen-go: v1.32.0
- protoc: v4.25.1
改动部分:
客户端有 bug,复现方法:
kratos run
go test -run TestHttpClient ./internal/data
(或者用 IDE 打开 client 测试代码手动点击测试)。
- 观察控制台输出。
本来应该能正常请求的,结果 404:
--- FAIL: TestHttpClient (0.00s)
client_test.go:27: error: code = 404 reason = message = metadata = map[] cause = proto: syntax error (line 1:1): unexpected token 404
FAIL
FAIL github.com/kvii/issue3141/internal/data 2.620s
FAIL
看服务端控制台日志。实际上请求的 url 是 "/my-api/" 而非 "/my-api/id",所以 404 了。
INFO ts=2024-01-10T15:41:11+08:00 caller=server/http.go:38 service.id=192.168.1.66 service.name= service.version= trace.id= span.id= module=http msg=request method=POST url=/my-api/
服务端是正常的,复现方法:
kratos run
curl http://localhost:8000/my-api/1 -X POST -H 'Content-Type: application/json' -d '{"msg":[{}]}'
- 观察控制台输出
结果正常打印了所有字段。
id:"1" msg:{}
Directories
¶
Click to show internal directories.
Click to hide internal directories.