Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
pkg
curlx
Commits
83e815bd
Commit
83e815bd
authored
1 year ago
by
yun
Browse files
Options
Download
Email Patches
Plain Diff
一些优化
parent
7254a9c8
master
v1.0.12
v1.0.11
v1.0.10
v1.0.9
Pipeline
#108
failed with stages
in 6 minutes and 29 seconds
Changes
3
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
curlx.go
+3
-1
curlx.go
params.go
+9
-0
params.go
post.go
+10
-0
post.go
with
22 additions
and
1 deletion
+22
-1
curlx.go
+
3
-
1
View file @
83e815bd
...
...
@@ -182,7 +182,9 @@ func (c *Curlx) SendWithResponee(ctx context.Context, ps ...Param) Response {
if
n
==
0
{
break
}
body
=
append
(
body
,
buf
...
)
// 读取n个字节
body
=
append
(
body
,
buf
[
:
n
]
...
)
// body = append(body, buf...)
}
default
:
body
,
_
=
io
.
ReadAll
(
resp
.
Body
)
...
...
This diff is collapsed.
Click to expand it.
params.go
+
9
-
0
View file @
83e815bd
...
...
@@ -106,6 +106,15 @@ func SetUserAgent(userAgent UserAgent) Param {
}
}
/**
* 设置Referer
*/
func
SetReferer
(
referer
string
)
Param
{
return
func
(
param
*
ClientParams
)
{
param
.
Headers
[
"Referer"
]
=
referer
}
}
/**
* 设置cookies
*/
...
...
This diff is collapsed.
Click to expand it.
post.go
0 → 100644
+
10
-
0
View file @
83e815bd
package
curlx
import
(
"io"
"net/http"
)
func
Post
(
url
string
,
contentType
string
,
body
io
.
Reader
)
(
resp
*
http
.
Response
,
err
error
)
{
return
http
.
Post
(
url
,
contentType
,
body
)
}
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Snippets