Commit Graph

269 Commits

Author SHA1 Message Date
Kevin Wan
14caf5c799
chore: simplify tests with logtest (#3184) 2023-04-29 20:36:29 +08:00
Kevin Wan
7568674b2b
chore: use %q instead of %s for unmarshaling (#3163) 2023-04-24 12:11:12 +08:00
Kevin Wan
3da740b7fc
chore: remove unnecessary code (#3161) 2023-04-23 22:58:22 +08:00
chen quan
ce4eb6ed61
fix: fixed #2945 (#2953)
Co-authored-by: Kevin Wan <wanjunfeng@gmail.com>
2023-04-23 14:22:03 +00:00
cong
22fad4bb9c
feat(trace): add trace test helpers (#3108) 2023-04-08 14:52:25 +00:00
Kevin Wan
8d0cceb80c
chore: add more tests (#3084) 2023-03-31 22:33:43 +08:00
heyehang
e06abf4f6f
fixbug:superfluous response.WriteHeader (#3083) 2023-03-31 13:05:29 +00:00
Kevin Wan
6170d7b790
feat: rest validation on http requests (#3041) 2023-03-19 12:04:18 +00:00
Kevin Wan
60a13f1e53
chore: add more tests (#3018) 2023-03-12 20:42:50 +08:00
sniperwzq
3e093bf34e
defines the method to customize http server (#2171) 2023-03-11 23:15:00 +08:00
Kevin Wan
211b9498ef
chore: add more tests (#3016) 2023-03-11 22:22:39 +08:00
Kevin Wan
0d5a68869d
fix: gateway conf doesn't work (#2968) 2023-03-05 22:19:58 +08:00
Kevin Wan
d9d79e930d
Merge pull request from GHSA-fgxv-gw55-r5fq
* fix: Authorization Bypass Through User-Controlled Key

* chore: add not safe domain test
2023-03-04 23:34:11 +08:00
yangjinheng
dbc8f9faca timeout writer add hijack 2023-03-04 11:50:04 +00:00
yangjinheng
96998ae570 Update timeouthandler.go 2023-03-04 11:50:04 +00:00
Kevin Wan
66be213346
chore: refine rest validator (#2928)
* chore: refine rest validator

* chore: add more tests

* chore: reformat code

* chore: add comments
2023-02-26 21:58:58 +08:00
Qiying Wang
92c8899f47
feat: add configurable validator for httpx.Parse (#2923)
Co-authored-by: qiying.wang <qiying.wang@highlight.mobi>
2023-02-26 20:40:22 +08:00
Kevin Wan
238c830f17
fix: timeout not working if greater than global rest timeout (#2926) 2023-02-26 20:22:20 +08:00
chenquan
3bc40d9eaf fix: fixed the bug that old trace instances may be fetched 2023-02-22 13:01:22 +00:00
Kevin Wan
ae87114282
chore: change interface{} to any (#2818)
* chore: change interface{} to any

* chore: update goctl version to 1.5.0

* chore: update goctl deps
2023-01-24 16:32:02 +08:00
Kevin Wan
696da4efee
chore: add more tests (#2815)
* chore: add more tests

* chore: add more tests

* chore: add more tests

* chore: add more tests

* chore: add more tests

* chore: add more tests
2023-01-24 13:43:13 +08:00
Kevin Wan
4d7fa08b0b
feat: support **struct in mapping (#2784)
* feat: support **struct in mapping

* chore: fix test failure
2023-01-12 20:45:32 +08:00
Kevin Wan
367afb544c
feat: support ptr of ptr of ... in mapping (#2779)
* feat: support ptr of ptr of ... in mapping

* feat: support ptr of ptr of time.Duration in mapping

* feat: support ptr of ptr of json.Number in mapping

* chore: improve setting in mapping

* feat: support ptr of ptr encoding.TextUnmarshaler in mapping

* chore: add more tests

* fix: string ptr

* chore: update tests
2023-01-12 15:56:51 +08:00
cong
43b8c7f641
chore(trace): improve rest tracinghandler (#2783) 2023-01-12 12:50:57 +08:00
cong
f9619328f2
refactor(rest): use static config for trace ignore paths. (#2773) 2023-01-12 09:40:18 +08:00
Kevin Wan
ade6f9ee46
feat: add middlewares config for rest (#2765)
* feat: add middlewares config for rest

* chore: disable logs in tests

* chore: enable verbose in tests
2023-01-08 16:41:53 +08:00
chen quan
dc260f196a
refactor: simplify the code (#2763)
* refactor: simplify the code

* fix: fix data race

* refactor: simplify the code

* refactor: simplify the code
2023-01-07 13:32:56 +08:00
chen quan
fc9b3ffdc1
refactor: use opentelemetry's standard api to track http status code (#2760) 2023-01-06 23:27:54 +08:00
chen quan
21c49009c0
chore: remove unnecessary code (#2754) 2023-01-05 22:12:07 +08:00
Kevin Wan
83f88d177f
chore: improve codecov (#2752) 2023-01-04 13:42:20 +08:00
xiang
641ebf1667
feat: trace http.status_code (#2708)
* feat: trace http.status_code

* feat: implements http.Flusher & http.Hijacker for traceResponseWriter

* test: delete notTracingSpans after test

* feat: trace http.status_code

* feat: implements http.Flusher & http.Hijacker for traceResponseWriter

* test: delete notTracingSpans after test

* refactor: update trace handler span message

* fix: code conflict
2023-01-04 10:21:57 +08:00
Kevin Wan
dd294e8cd6
fix: #2700, timeout not enough for writing responses (#2738)
* fix: #2700, timeout not enough for writing responses

* fix: test fail

* chore: add comments
2023-01-02 13:51:15 +08:00
JackSon_tm.m
3e9d0161bc
add ServeHTTP to Server/Engin for doing Httptest (#2704) 2023-01-02 00:24:58 +08:00
Kevin Wan
cf6c349118
fix: #2735 (#2736)
* fix: #2735

* chore: make error consistent
2023-01-01 12:21:53 +08:00
Kevin Wan
7a75dce465
refactor: remove duplicated code (#2705) 2022-12-14 23:36:56 +08:00
Kevin Wan
fdc57d07d7
fix: #2672 (#2681)
* fix: #2672

* chore: fix more cases

* chore: update deps

* chore: update deps

* chore: refactor

* chore: refactor

* chore: refactor
2022-12-11 00:41:50 +08:00
re-dylan
ef22042f4d
feat: add dev server and health (#2665)
* feat: add dev server and health

* fix: fix ci

* fix: fix comment.

* feat: add enabled

* remove no need test

* feat: mv devServer to internal

* feat: default enable pprof

Co-authored-by: dylan.wang <dylan.wang@yijinin.com>
2022-12-10 20:40:23 +08:00
heyehang
a644ec7edd
feature : responses whit context (#2637) 2022-12-03 18:48:02 +08:00
chen quan
97a8b3ade5
fix(rest): fix issues#2628 (#2629) 2022-11-23 22:50:08 +08:00
王哈哈
dac3600b53
Modify comment syntax error (#2572) 2022-11-04 21:55:17 +08:00
Kevin Wan
9cadab2684
chore: refactor (#2545)
* chore: refactor

* chore: refactor
2022-10-22 22:52:40 +08:00
chen quan
7fe2492009
feat(trace): support for disabling tracing of specified spanName (#2363) 2022-10-22 22:14:12 +08:00
Kevin Wan
05a5de7c6d
chore: fix lint errors (#2520) 2022-10-17 06:30:58 +08:00
Kevin Wan
d4c9fd2aff
chore: add golangci-lint config file (#2519)
* chore: add golangci-lint config file

* chore: member alignment
2022-10-14 22:45:48 +08:00
Kevin Wan
773b59106b
chore: remove init if possible (#2485) 2022-10-06 23:57:56 +08:00
chen quan
111e626a73
refactor: adjust http request slow log format (#2440) 2022-09-23 21:20:38 +08:00
dawn_zhou
ae7f1aabdd
feat: mysql and redis metric support (#2355)
* feat: mysql and redis metric support

* feat: mysql and redis metric support

* feat: mysql and redis metric support

Co-authored-by: dawn.zhou <dawn.zhou@yijinin.com>
2022-09-17 19:35:30 +08:00
Kevin Wan
d935c83a54
feat: support baggage propagation in httpc (#2375)
* feat: support baggage propagation in httpc

* chore: use go 1.16

* chore: use go 1.16

* chore: use go ^1.16

* chore: remove deprecated
2022-09-10 15:18:52 +08:00
maizige
cfda972d50
fix:trace graceful stop,pre loss trace (#2358) 2022-09-07 10:33:01 +08:00
Archer
6078bf1a04
correct test case (#2340) 2022-09-04 21:14:56 +08:00
Kevin Wan
5d00dfb962
fix: handle the scenarios that content-length is invalid (#2313) 2022-08-28 15:41:02 +08:00
Kevin Wan
d9620bb072
chore: remove unused packages (#2312) 2022-08-28 14:20:03 +08:00
Kevin Wan
4cb68a034a
fix #2163 (#2283) 2022-08-24 20:19:53 +08:00
Kevin Wan
f3645e420e
test: add more tests (#2261) 2022-08-13 10:31:23 +08:00
Kevin Wan
6357e27418
fix: test failure, due to go 1.19 compatibility (#2256) 2022-08-11 22:55:12 +08:00
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
2022-08-07 16:09:54 +08:00
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
2022-07-28 22:08:48 +08:00
chen quan
003adae51f
fix(httpc): fix typo errors (#2189) 2022-07-27 09:11:15 +08:00
Kevin Wan
b206dd28a3
feat: support form values in gateway (#2158) 2022-07-16 23:40:53 +08:00
Kevin Wan
3bad043413
chore: refactor (#2130) 2022-07-11 23:50:50 +08:00
虫子樱桃
d71b3c841f
feat:Add Routes method for server (#2125)
Co-authored-by: czyt <czyt@w.cn>
2022-07-11 23:23:38 +08:00
家福
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>
2022-07-01 23:21:31 +08:00
Zhang.Y
7da77302f4
fix: \u003cnil\u003e log output when http server shutdown. (#2055) 2022-06-29 21:35:01 +08:00
Kevin Wan
47c49de94e
feat: rest.WithChain to replace builtin middlewares (#2033)
* feat: rest.WithChain to replace builtin middlewares

* chore: add comments

* chore: refine code
2022-06-19 17:41:33 +08:00
Kevin Wan
018ca82048
chore: refactor to simplify disabling builtin middlewares (#2031)
* chore: refactor to simplify disabling builtin middlewares

* chore: rename methods
2022-06-18 20:16:34 +08:00
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>
2022-06-18 18:45:47 +08:00
chen quan
6518eb10b3
feat: add trace in httpc (#2011) 2022-06-17 15:01:14 +08:00
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
2022-06-11 23:07:26 +08:00
Kevin Wan
af05219b70
test: make tests stable (#1968)
* test: make tests stable

* test: fix fails
2022-06-04 23:46:29 +08:00
Kevin Wan
f366e1d936
chore: make print pretty (#1967) 2022-06-04 19:53:22 +08:00
Kevin Wan
b6b96d9dad
feat: print routes (#1964)
* feat: print rest routes

* feat: print rest routes
2022-06-04 13:26:14 +08:00
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
2022-05-21 14:34:01 +08:00
Kevin Wan
6d2b9fd904
chore: improve codecov (#1878) 2022-05-08 13:17:48 +08:00
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
2022-05-07 23:22:39 +08:00
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
2022-05-06 15:13:46 +08:00
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
2022-05-03 17:34:26 +08:00
Kevin Wan
f21970c117
test: add more tests (#1856) 2022-05-02 21:24:20 +08:00
Kevin Wan
3bbc90ec24
refactor: move json related header vars to internal (#1840)
* refactor: move json related header vars to internal

* refactor: use header.ContentType
2022-04-28 15:12:04 +08:00
Kevin Wan
cef83efd4e
fix #1838 (#1839) 2022-04-28 11:25:26 +08:00
Kevin Wan
f7a60cdc24
fix: remove deprecated dependencies (#1837)
* fix: remove deprecated dependencies

* backup

* fix test error
2022-04-27 21:34:54 +08:00
Kevin Wan
5c9fae7e62
feat: support sub domain for cors (#1827) 2022-04-25 21:56:59 +08:00
Vee Zhang
94ddb3380e
fix: rest: WriteJson get 200 when Marshal failed. (#1803)
Only the first WriteHeader call takes effect.
2022-04-21 21:55:01 +08:00
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
2022-04-19 14:03:04 +08:00
Kevin Wan
92b450eb11
fix: ignore timeout on websocket (#1802) 2022-04-18 20:14:46 +08:00
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
2022-04-15 19:07:34 +08:00
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
2022-04-11 11:00:28 +08:00
Kevin Wan
ab01442d46
add more tests (#1763)
* feat: add goctl docker build scripts

* chore: add more tests
2022-04-06 16:09:06 +08:00
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
2022-04-03 14:32:27 +08:00
Kevin Wan
2b9fc26c38
refactor: guard timeout on API files (#1726) 2022-03-31 21:39:02 +08:00
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
2022-03-31 20:20:00 +08:00
Kevin Wan
ec271db7a0
chore: refactor code (#1699) 2022-03-23 18:24:44 +08:00
Kevin Wan
c1d9e6a00b
feat: add httpc.Parse (#1698) 2022-03-23 17:58:21 +08:00
Kevin Wan
f9e6013a6c
refactor: httpc package for easy to use (#1645) 2022-03-15 14:18:46 +08:00
Kevin Wan
b5d1d8b0d1
refactor: httpc package for easy to use (#1643) 2022-03-14 20:15:14 +08:00
Kevin Wan
2a5717d7fb
feat: add httpc/Service for convinience (#1641) 2022-03-14 15:36:06 +08:00
Kevin Wan
85cf662c6f
feat: add httpc/Get httpc/Post (#1640) 2022-03-13 14:49:14 +08:00
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
2022-03-13 14:11:14 +08:00
Kevin Wan
3b7ca86e4f
chore: add unit tests (#1615)
* test: add more tests

* test: add more tests
2022-03-04 17:54:09 +08:00
Kevin Wan
842656aa90
feat: log 404 requests with traceid (#1554) 2022-02-19 20:50:33 +08:00
Kevin Wan
fdc7f64d6f
chore: update unauthorized callback calling order (#1469)
* chore: update unauthorized callback calling order

* chore: add comments
2022-01-20 21:09:45 +08:00