Commit Graph

220 Commits (b028ed058d6a86f94e859fbd822c7297c8bf7288)

Author SHA1 Message Date
Archer 6078bf1a04
correct test case (#2340) 2 years ago
Kevin Wan 5d00dfb962
fix: handle the scenarios that content-length is invalid (#2313) 2 years ago
Kevin Wan d9620bb072
chore: remove unused packages (#2312) 2 years ago
Kevin Wan 4cb68a034a
fix #2163 (#2283) 2 years ago
Kevin Wan f3645e420e
test: add more tests (#2261) 2 years ago
Kevin Wan 6357e27418
fix: test failure, due to go 1.19 compatibility (#2256) 2 years ago
Kevin Wan a987512c7b
feat: more meaningful error messages, close body on httpc requests (#2238)
* feat: more meaningful error messages, close body on httpc requests

* fix: test failure
2 years ago
Kevin Wan 5cd9229986
fix: only setup logx once (#2188)
* fix: only setup logx once

* fix: test failure

* chore: not reset logging level in reset

* chore: refactoring
2 years ago
chen quan 003adae51f
fix(httpc): fix typo errors (#2189) 2 years ago
Kevin Wan b206dd28a3
feat: support form values in gateway (#2158) 2 years ago
Kevin Wan 3bad043413
chore: refactor (#2130) 2 years ago
虫子樱桃 d71b3c841f
feat:Add `Routes` method for server (#2125)
Co-authored-by: czyt <czyt@w.cn>
2 years ago
家福 f3b8fef34f
fix: type matching supports string to int (#2038)
* fix: type matching supports string to int

* feat: type matching supports string to int

Co-authored-by: 程家福 <chengjiafu@uniontech.com>
2 years ago
Zhang.Y 7da77302f4
fix: `\u003cnil\u003e` log output when http server shutdown. (#2055) 2 years ago
Kevin Wan 47c49de94e
feat: rest.WithChain to replace builtin middlewares (#2033)
* feat: rest.WithChain to replace builtin middlewares

* chore: add comments

* chore: refine code
2 years ago
Kevin Wan 018ca82048
chore: refactor to simplify disabling builtin middlewares (#2031)
* chore: refactor to simplify disabling builtin middlewares

* chore: rename methods
2 years ago
magickeha 6976ba7e13
add user middleware chain function (#1913)
* add user middleware chain function

* fix staticcheck SA4006

* chang code Implementation style

Co-authored-by: kemq1 <kemq1@spdb.com.cn>
2 years ago
chen quan 6518eb10b3
feat: add trace in httpc (#2011) 2 years ago
Kevin Wan ed1c937998
feat: convert grpc errors to http status codes (#1997)
* feat: convert grpc errors to http status codes

* chore: circuit break include unimplemented grpc error

* chore: add reference link in comments
2 years ago
Kevin Wan af05219b70
test: make tests stable (#1968)
* test: make tests stable

* test: fix fails
3 years ago
Kevin Wan f366e1d936
chore: make print pretty (#1967) 3 years ago
Kevin Wan b6b96d9dad
feat: print routes (#1964)
* feat: print rest routes

* feat: print rest routes
3 years ago
Kevin Wan 6b1e15cab1
chore: update k8s.io/client-go for security reason, go is upgrade to 1.16 (#1912)
* chore: fix jwt dependency security issue

* chore: update clickhouse driver

* chore: fix a security issue

* chore: update dependencies
3 years ago
Kevin Wan 6d2b9fd904
chore: improve codecov (#1878) 3 years ago
Kevin Wan 69c2bad410
feat: logx with color (#1872)
* feat: logx with color

* chore: update logs

* fix test error

* chore: change colors of http codes

* chore: add comments

* chore: use faith/color instead of ascii code color

* chore: update colors

* chore: update colors

* chore: fix duplicated slowcall text

* chore: remove slowcall colors
3 years ago
Kevin Wan d0a59b13a6
chore: fix deprecated usages (#1871)
* add conf documents

* chore: use {} instead of () for environment variables

* chore: fix deprecated usages

* chore: fix unstable tests

* chore: show stack on github actions
3 years ago
Kevin Wan ac321fc146
feat: add fields with logx methods, support using third party logging libs. (#1847)
* backup

* simplify

* chore: remove unused pool

* chore: fix lint errors

* chore: use strings.Builder instead of bytes.Buffer

* test: add more tests

* chore: fix reviewdog

* test: fix data race

* feat: make logger customizable

* chore: fix reviewdog

* test: fix fails

* chore: fix set writer twice

* chore: use context instead of golang.org context

* chore: specify uint32 for level types
3 years ago
Kevin Wan f21970c117
test: add more tests (#1856) 3 years ago
Kevin Wan 3bbc90ec24
refactor: move json related header vars to internal (#1840)
* refactor: move json related header vars to internal

* refactor: use header.ContentType
3 years ago
Kevin Wan cef83efd4e
fix #1838 (#1839) 3 years ago
Kevin Wan f7a60cdc24
fix: remove deprecated dependencies (#1837)
* fix: remove deprecated dependencies

* backup

* fix test error
3 years ago
Kevin Wan 5c9fae7e62
feat: support sub domain for cors (#1827) 3 years ago
Vee Zhang 94ddb3380e
fix: rest: WriteJson get 200 when Marshal failed. (#1803)
Only the first WriteHeader call takes effect.
3 years ago
Kevin Wan 2cdff97934
feat: use mongodb official driver instead of mgo (#1782)
* wip: backup

* wip: backup

* wip: backup

* backup

* backup

* backup

* add more tests

* fix wrong dependency

* fix lint errors

* remove test due to data race

* add tests

* fix test error

* add mon.Model

* add mon.Model unmarshal

* add monc

* add more tests for monc

* add more tests for monc

* add docs for mon and monc packages

* fix doc errors

* chhore: add comment

* chore: fix test bug

* chore: refine tests

* chore: remove primitive.NewObjectID in test code

* chore: rename test files for typo
3 years ago
Kevin Wan 92b450eb11
fix: ignore timeout on websocket (#1802) 3 years ago
Kevin Wan cb4fcf2c6c
fix marshal ptr in httpc (#1789)
* fix marshal ptr in httpc

* add more tests

* add more tests

* add more tests

* fix issue on options and optional both provided
3 years ago
Kevin Wan 50de01fb49
feat: add httpc.Do & httpc.Service.Do (#1775)
* backup

* backup

* backup

* feat: add httpc.Do & httpc.Service.Do

* fix: not using strings.Cut, it's from Go 1.18

* chore: remove redudant code

* feat: httpc.Do finished

* chore: fix reviewdog

* chore: break loop if found

* add more tests
3 years ago
Kevin Wan ab01442d46
add more tests (#1763)
* feat: add goctl docker build scripts

* chore: add more tests
3 years ago
Kevin Wan 78ea0769fd
feat: simplify httpc (#1748)
* feat: simplify httpc

* chore: fix lint errors

* chore: fix log url issue

* chore: fix log url issue

* refactor: handle resp & err in ResponseHandler

* chore: remove unnecessary var names in return clause
3 years ago
Kevin Wan 2b9fc26c38
refactor: guard timeout on API files (#1726) 3 years ago
Xiaoju Jiang 321dc2d410
Added support for setting the parameter size accepted by the interface and custom timeout and maxbytes in API file (#1713)
* Added support for setting the parameter size accepted by the interface

* support custom timeout and maxbytes in API file

* support timeout used unit

* remove goctl maxBytes
3 years ago
Kevin Wan ec271db7a0
chore: refactor code (#1699) 3 years ago
Kevin Wan c1d9e6a00b
feat: add httpc.Parse (#1698) 3 years ago
Kevin Wan f9e6013a6c
refactor: httpc package for easy to use (#1645) 3 years ago
Kevin Wan b5d1d8b0d1
refactor: httpc package for easy to use (#1643) 3 years ago
Kevin Wan 2a5717d7fb
feat: add httpc/Service for convinience (#1641) 3 years ago
Kevin Wan 85cf662c6f
feat: add httpc/Get httpc/Post (#1640) 3 years ago
Kevin Wan 3279a7ef0f
feat: add rest/httpc to make http requests governacible (#1638)
* feat: change x-trace-id to traceparent to follow opentelemetry

* feat: add rest/httpc to make http requests governacible

* chore: remove blank lines
3 years ago
Kevin Wan 3b7ca86e4f
chore: add unit tests (#1615)
* test: add more tests

* test: add more tests
3 years ago
Kevin Wan 842656aa90
feat: log 404 requests with traceid (#1554) 3 years ago
Kevin Wan fdc7f64d6f
chore: update unauthorized callback calling order (#1469)
* chore: update unauthorized callback calling order

* chore: add comments
3 years ago
Kevin Wan bf2feee5b7
feat: implement console plain output for debug logs (#1456)
* feat: implement console plain output for debug logs

* chore: rename console encoding to plain

* chore: refactor names
3 years ago
Kevin Wan 272a3f347d
chore: remove jwt deprecated (#1452) 3 years ago
Kevin Wan 468c237189
chore: upgrade dependencies (#1444)
* chore: upgrade dependencies

* ci: upgrade go to 1.15
3 years ago
Kevin Wan ba6a7c9dc8
chore: refactor rest/timeouthandler (#1415) 3 years ago
Kevin Wan a91c3907a8
feat: rename module from tal-tech to zeromicro (#1413) 3 years ago
Kevin Wan 62266d8f91
fix #1070 (#1389)
* fix #1070

* test: add more tests
3 years ago
Kevin Wan cd289465fd
chore: coding style and comments (#1361)
* chore: coding style and comments

* chore: optimize `ParseJsonBody` (#1353)

* chore: optimize `ParseJsonBody`

* chore: optimize `ParseJsonBody`

* fix: fix a test

* chore: optimize `ParseJsonBody`

* fix a test

* chore: add comment

* chore: refactor

Co-authored-by: chenquan <chenquan.dev@foxmail.com>
3 years ago
chenquan 263e426ae1
chore: optimize `ParseJsonBody` (#1353)
* chore: optimize `ParseJsonBody`

* chore: optimize `ParseJsonBody`

* fix: fix a test

* chore: optimize `ParseJsonBody`

* fix a test

* chore: add comment
3 years ago
charliecen d5e493383a
chose: cancel the assignment and judge later (#1359)
Co-authored-by: charliecen <chq@abierr.com>
3 years ago
Kevin Wan 6f1d27354a
chore: put error message in error.log for verbose mode (#1355) 3 years ago
Kevin Wan 26101732d2
test: add more tests (#1352) 3 years ago
Kevin Wan 71d40e0c08
Revert "排除客户端中断导致的503错误 (#1343)" (#1351)
This reverts commit 2cdf5e7395.
3 years ago
Kevin Wan 4ba2ff7cdd
feat: treat client closed requests as code 499 (#1350)
* feat: treat client closed requests as code 499

* chore: add comments
3 years ago
vic 2cdf5e7395
排除客户端中断导致的503错误 (#1343) 3 years ago
Kevin Wan 3dda557410
chore: only allow cors middleware to change headers (#1276) 3 years ago
Kevin Wan c800f6f723
chore: avoid superfluous WriteHeader call errors (#1275) 3 years ago
Kevin Wan 0395ba1816
feat: add rest.WithCustomCors to let caller customize the response (#1274) 3 years ago
Kevin Wan a6c8113419
chore: refactor, better goctl message (#1228) 3 years ago
Kevin Wan 9d0b51fa26
fixes #1222 (#1223) 3 years ago
Kevin Wan 28409791fa
feat: support CORS, better implementation (#1217)
* feat: support CORS, better implementation

* chore: refine code
3 years ago
Kevin Wan c28e01fed3
feat: support CORS by using rest.WithCors(...) (#1212)
* feat: support CORS by using rest.WithCors(...)

* chore: add comments

* refactor: lowercase unexported methods

* ci: fix lint errors
3 years ago
Kevin Wan 3ede597a15
feat: support customizing timeout for specific route (#1203)
* feat: support customizing timeout for specific route

* test: add more tests
3 years ago
Kevin Wan 91b10bd3b9
feat: add rest.WithPrefix to support route prefix (#1194) 3 years ago
Kevin Wan 7e3fe77e7b
chore: update goctl version to 1.2.3, prepare for release (#1193)
* feat: slow threshold customizable in rest

* chore: update goctl version to 1.2.3, prepare for release
3 years ago
Kevin Wan ba43214dae
feat: slow threshold customizable in zrpc (#1191)
* feat: slow threshold customizable in rest

* feat: slow threshold customizable in rest

* feat: slow threshold customizable in rest

* feat: slow threshold customizable in zrpc
3 years ago
Kevin Wan ebc90720ea
feat: slow threshold customizable in rest (#1189)
* feat: slow threshold customizable in rest

* feat: slow threshold customizable in rest
3 years ago
Kevin Wan 769d06c8ab
refactor: simplify tls config in rest (#1181) 3 years ago
Howie cd1f8da13f
[update] add plugin config (#1180)
Signed-off-by: lihaowei <haoweili35@gmail.com>
3 years ago
Kevin Wan 496a2f341e
test: add more tests (#1163)
* chore: reverse the order of stopping services

* chore: reverse the order of stopping services

* test: add more tests
3 years ago
Kevin Wan 5636bf4955
test: add more tests (#1150) 3 years ago
chenquan 022c100dc9
Add request method in http log (#1120)
* Add request method in http log

* Update log format
3 years ago
Kevin Wan 10e7922597
feat: opentelemetry integration, removed self designed tracing (#1111)
* feat: opentelemetry integration, removed self designed tracing

* feat: support zipkin on opentelemetry integration

* feat: support zipkin on opentelemetry integration, enable it in conf

* style: format code

* fix: support logx without exporter configured

* fix: check return values

* refactor: simplify code

* refactor: simplify opentelemetry integration

* ci: fix staticcheck errors
3 years ago
Kevin Wan ed15ca04f4
fix: opentelemetry traceid not correct (#1108) 3 years ago
Kevin Wan 65905b914d
ci: add reviewdog (#1096) 3 years ago
Kevin Wan 1eb1450c43
downgrade golang-jwt to support go 1.14 (#1073) 3 years ago
Kevin Wan 30e49f2939
fix jwt security issue by using golang-jwt package (#1066) 3 years ago
Kevin Wan 6476da4a18
rest log with context (#998) 3 years ago
Allen Liu 3b683fd498
feat: change logger to traceLogger for getting traceId when recovering (#374) 3 years ago
Kevin Wan 58874779e7
move opentelemetry into trace package, and refactoring (#996)
* move opentelemetry into trace package, and refactoring

* rename rewritten package names
3 years ago
Kevin Wan 9bdadf2381
fix golint issues (#992) 3 years ago
Kevin Wan 407a6cbf9c
format coding style (#983) 3 years ago
Vee Zhang 76fc1ef460
httpx.Error response without body (#982)
* httpx.Error support response without body

* fix doc
3 years ago
Kevin Wan 7618139dad
refactor (#977) 3 years ago
zhoushuguang 280e837c9e
rest otel support (#943) 3 years ago
Kevin Wan f669e1226c
fix #556 (#938) 3 years ago
Kevin Wan 9672298fa8
make sure setting code happen before callback in rest (#936) 3 years ago
Kevin Wan 9c1ee50497
refactor (#920) 3 years ago
chenquan 7c842f22d0
Add traceId to the response headers (#919)
* Add traceId to the request headers

* Add test cases

* Update refactor code
3 years ago
Kevin Wan fc04ad7854
export pathvar for user-defined routers (#911)
* refactor

* export pathvar for user-defined routers
3 years ago