Commit 83e815bd authored by yun's avatar yun
Browse files

一些优化

Pipeline #108 failed with stages
in 6 minutes and 29 seconds
Showing with 22 additions and 1 deletion
+22 -1
......@@ -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)
......
......@@ -106,6 +106,15 @@ func SetUserAgent(userAgent UserAgent) Param {
}
}
/**
* 设置Referer
*/
func SetReferer(referer string) Param {
return func(param *ClientParams) {
param.Headers["Referer"] = referer
}
}
/**
* 设置cookies
*/
......
post.go 0 → 100644
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)
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment