Skip to content

Commit

Permalink
BaseSession._set_curl_options(): fix method setopt
Browse files Browse the repository at this point in the history
  • Loading branch information
deedy5 committed Apr 1, 2024
1 parent 0847c44 commit 1aa8c23
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions curl_cffi/requests/session.py
Expand Up @@ -281,7 +281,12 @@ def _set_curl_options(
c = curl

# method
c.setopt(CurlOpt.CUSTOMREQUEST, method.encode())
if method == "POST":
c.setopt(CurlOpt.POST, 1)
elif method == "HEAD":
c.setopt(CurlOpt.NOBODY, 1)
elif method != "GET":
c.setopt(CurlOpt.CUSTOMREQUEST, method.encode())

# url
if self.params:
Expand Down Expand Up @@ -524,9 +529,6 @@ def qput(chunk):
header_buffer = BytesIO()
c.setopt(CurlOpt.HEADERDATA, header_buffer)

if method == "HEAD":
c.setopt(CurlOpt.NOBODY, 1)

# interface
interface = interface or self.interface
if interface:
Expand Down

0 comments on commit 1aa8c23

Please sign in to comment.