Skip to content

Commit

Permalink
fix: avoid repeated append cookies when retry (#353)
Browse files Browse the repository at this point in the history
  • Loading branch information
imroc committed May 16, 2024
1 parent 2b40602 commit 47d3033
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ package req

import (
"bytes"
"github.com/imroc/req/v3/internal/header"
"github.com/imroc/req/v3/internal/util"
"io"
"mime/multipart"
"net/http"
Expand All @@ -14,6 +12,9 @@ import (
"reflect"
"strings"
"time"

"github.com/imroc/req/v3/internal/header"
"github.com/imroc/req/v3/internal/util"
)

type (
Expand Down Expand Up @@ -489,7 +490,7 @@ func parseRequestHeader(c *Client, r *Request) error {
}

func parseRequestCookie(c *Client, r *Request) error {
if len(c.Cookies) == 0 {
if len(c.Cookies) == 0 || r.RetryAttempt > 0 {
return nil
}
r.Cookies = append(r.Cookies, c.Cookies...)
Expand Down

0 comments on commit 47d3033

Please sign in to comment.