is-Xiaoen
30c8e77246
fix: improve type safety in httpWithTLS for custom RoundTripper ( #861 )
...
* fix: improve type safety in httpWithTLS for custom RoundTripper
Add type assertion check to handle cases where DefaultHTTPClient.Transport
is a custom http.RoundTripper implementation (not *http.Transport).
This improves upon the fix in PR #844 which only handled nil Transport.
The previous code would still panic if users set a custom RoundTripper:
trans := baseTransport.(*http.Transport).Clone() // panic if not *http.Transport
Now safely handles three scenarios:
1. Transport is nil -> use http.DefaultTransport
2. Transport is *http.Transport -> clone it
3. Transport is custom RoundTripper -> use http.DefaultTransport
Added comprehensive test cases:
- TestHttpWithTLS_NilTransport
- TestHttpWithTLS_CustomTransport
- TestHttpWithTLS_CustomRoundTripper
Related to #803
* refactor: reduce code duplication and complexity in httpWithTLS
- Eliminate duplicate http.DefaultTransport.Clone() calls
- Reduce cyclomatic complexity by simplifying conditional logic
- Use nil check pattern instead of nested else branches
- Maintain same functionality with cleaner code structure
This addresses golangci-lint warnings for dupl and gocyclo.
* fix: add newline at end of http_test.go
Fix gofmt -s compliance issue:
- File must end with newline character
- Addresses golangci-lint gofmt error on line 81
This fixes CI check failure.
2025-10-27 14:24:24 +08:00
silenceper
ee5f045b89
fix panic ( #844 )
2025-07-24 09:59:13 +08:00
litterGuy
23bb10b0c9
fix: ImageUpload 接口报错 'media data missing hint:' ( #832 )
2025-04-27 10:08:51 +08:00
oah8
c1770130a0
add stream_upload_source ( #786 )
...
Co-authored-by: _oah <57302072@qq.com >
2024-08-22 14:21:58 +08:00
sam
6b3532cc2d
feat: Material 增加 AddMaterialFromReader 与 AddVideoFromReader 方法 ( #780 )
...
* feat: Material 增加 AddMaterialFromReader 与 AddVideoFromReader 方法
* update: 调整 PostFileFromReader 参数。
2024-07-16 15:43:18 +08:00
oscar
97e1af5904
支持设置全局HTTPClient ( #761 )
...
* [新增]支持设置httpClient
* 增加说明
* 增加说明
* 格式化imports
* [fix]1.21.5 和golangci 有兼容性问题
* [fix]优化imports
2024-01-02 17:19:59 +08:00
zxfishhack
a5e674bf10
支持在请求前修改各api的地址 ( #736 )
...
* 增加URI修改接口,以支持正向代理
* Update http.go
* Update http.go
2023-11-02 09:44:08 +08:00
houseme
26b0aacb4c
feat: create mini program virtual payment ( #709 )
2023-08-21 22:09:30 +08:00
okhowang
07b7dc40fc
cache增加带Context版本,开放平台相关接口支持Context版本 ( #653 )
2023-04-03 20:32:44 +08:00
houseme
a8f7a24ff6
feat: improve comment and upgrade golang version 1.16 ( #604 )
...
* feat: improve action config and code comment
* feat: improve comment and upgrade golang version 1.16
* feat: improve import
2022-08-23 10:13:24 +08:00
stepbystep2
fdaffb6aa2
fix: typo ( #595 )
2022-08-02 20:16:38 +08:00
stepbystep2
108a65ecf3
添加GetPhoneNumberContext方法 ( #587 )
2022-07-28 00:08:08 +08:00
houseme
adf142dac2
feat: modify redis version to v8.11.5 ( #582 )
...
* [feature] Format the code and improve Mini Program authorization to obtain openid(miniprogram/auth/auth.go Code2Session)
* [feature] CheckEncryptedData (https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/user-info/auth.checkEncryptedData.html )
* upgrade json error
* upgrade json error
* [feature] Wallet Transfer returns the pointer object
* feat:Adaptation of new go-redis components
* improve code
* feat:upgrade golangci-lint-action version
* fix
* test ci
* fix
* test ci
* fix
* test
* improve code
* feat:GetPhoneNumber return ptr
* fix: ptr Elem() error
* improve code
* improve code
* improve code
* improve code
* upgrade go version v1.15
* improve .golangci.yml
* feat:modify redis version v8.11.5
Co-authored-by: houseme <houseme@outlook.com >
2022-07-20 11:25:15 +08:00
okhowang
1e2f909f34
小程序auth增加Context接口 ( #483 )
2021-09-17 10:11:22 +08:00
houseme
96c1f98944
[feature] Format the code and improve Mini Program authorization to o… ( #473 )
...
* [feature] Format the code and improve Mini Program authorization to obtain openid(miniprogram/auth/auth.go Code2Session)
* [feature] CheckEncryptedData (https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/user-info/auth.checkEncryptedData.html )
* upgrade json error
* upgrade json error
Co-authored-by: houseme <houseme@outlook.com >
2021-09-08 11:03:23 +08:00
silenceper
5d8fd1f5bd
fix 恢复直接使用enc.SetEscapeHTML参数 ( #412 )
...
Co-authored-by: zhenlinwen <zhenlinwen@tencent.com >
2021-06-23 09:49:41 +08:00
silenceper
c0da806e03
update golangci ( #349 )
...
* update golangci
2020-11-26 12:25:57 +08:00
silenceper
96678d2279
增加小程序-云开发http api
2019-11-26 13:09:36 +08:00
silenceper
3be94cd80d
Merge pull request #118 from akikistyle/add-refund
...
添加退款接口,util http增加CA证书
2019-04-23 21:12:06 +08:00
sunyaqiu
e66652f4b5
fix comment
2019-04-06 15:28:31 +08:00
sunyaqiu
f4f1860e67
fix some comment and struct field
2019-04-06 15:24:40 +08:00
sunyaqiu
02b3fcc648
add refund
2019-04-06 14:59:38 +08:00
jefferwang(王俊锋)
61476d351d
add PostJSONWithRespContentType
2019-02-19 15:11:45 +08:00
Mongo
a4a567e1d4
add H5 payment support
2017-10-29 21:01:27 +08:00
Mongo
97752d09a6
add jsapi payment demo version
2017-10-28 00:32:08 +08:00
silenceper
f37e318f05
enc.SetEscapeHTML 支持版本>=1.7,使用简单替换 #15
2017-02-13 00:38:02 +08:00
silenceper
7c4b8fe172
json marshal改为encode ,不转义html字符(例如:&) #15
2017-02-13 00:25:14 +08:00
wenzl
6727746f71
remove unused code
2016-09-19 23:32:47 +08:00
wenzl
4333691b37
oauth2,jssdk
2016-09-15 01:39:15 +08:00
wenzl
d9075933c1
实现access_token获取
2016-09-11 13:16:15 +08:00