Remove unneeded copy

This commit is contained in:
Anthony Wang 2022-03-30 16:29:47 -05:00
parent 1da0d49de7
commit fdae736f22
No known key found for this signature in database
GPG Key ID: BC96B00AEC5F2D76

View File

@ -100,9 +100,7 @@ func NewClient(user *user_model.User, pubID string) (c *Client, err error) {
// NewRequest function // NewRequest function
func (c *Client) NewRequest(b []byte, to string) (req *http.Request, err error) { func (c *Client) NewRequest(b []byte, to string) (req *http.Request, err error) {
byteCopy := make([]byte, len(b)) buf := bytes.NewBuffer(b)
copy(byteCopy, b)
buf := bytes.NewBuffer(byteCopy)
req, err = http.NewRequest(http.MethodPost, to, buf) req, err = http.NewRequest(http.MethodPost, to, buf)
if err != nil { if err != nil {
return return