Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request debug log loss cookie header when use CookieJar #424

Closed
cxfksword opened this issue Mar 26, 2021 · 1 comment · Fixed by #727
Closed

Request debug log loss cookie header when use CookieJar #424

cxfksword opened this issue Mar 26, 2021 · 1 comment · Fixed by #727
Labels
Milestone

Comments

@cxfksword
Copy link

I found Request debug log not print cookie header. for example:

package main

import (
	"fmt"
	"net/url"
	"github.com/go-resty/resty/v2"
)

func main() {
	client := resty.New()
	client.SetDebug(true)
	client.SetDebugBodyLimit(0)

	fmt.Println(">>>>>>>>>>>>>>>First Request")
	client.R().Get("https://www.google.com/")

	fmt.Println("")
	fmt.Println("Current jar cookies:")
	uri,_ := url.Parse("https://www.google.com/")
	fmt.Println(client.GetClient().Jar.Cookies(uri))
	fmt.Println("")

	fmt.Println(">>>>>>>>>>>>>>>Second Request")
	client.R().Get("https://www.google.com/")

}

output:

>>>>>>>>>>>>>>>First Request
2021/03/26 18:19:20.118074 DEBUG RESTY 
==============================================================================
~~~ REQUEST ~~~
GET  /  HTTP/1.1
HOST   : www.google.com
HEADERS:
	User-Agent: go-resty/2.6.0 (https://github.com/go-resty/resty)
BODY   :
***** NO CONTENT *****
------------------------------------------------------------------------------
~~~ RESPONSE ~~~
STATUS       : 200 OK
PROTO        : HTTP/2.0
RECEIVED AT  : 2021-03-26T18:19:20.117916+08:00
TIME DURATION: 1.390281955s
HEADERS      :
	Alt-Svc: h3-29=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"
	Cache-Control: private, max-age=0
	Content-Type: text/html; charset=ISO-8859-1
	Date: Fri, 26 Mar 2021 10:19:19 GMT
	Expires: -1
	P3p: CP="This is not a P3P policy! See g.co/p3phelp for more info."
	Server: gws
	Set-Cookie: 1P_JAR=2021-03-26-10; expires=Sun, 25-Apr-2021 10:19:19 GMT; path=/; domain=.google.com; Secure, NID=212=dg09nOkfsAUHX8cma6qdB53xERGeWqpeu4wb-nNXzD8mIz3nQhWcMSTgt41nS--yDc-6bk7GwApdZhMBfULy3QoWCHi3_4lAgucpKaeGuQc6fDD04TUmePF5q9NGWefW9zx1PwdrzCw3Qh95GumM2NLjrByo0vkPV2GFUyT9HCY; expires=Sat, 25-Sep-2021 10:19:19 GMT; path=/; domain=.google.com; HttpOnly
	X-Frame-Options: SAMEORIGIN
	X-Xss-Protection: 0
BODY         :
***** RESPONSE TOO LARGE (size - 14107) *****
==============================================================================

Current jar cookies:
[1P_JAR=2021-03-26-10 NID=212=dg09nOkfsAUHX8cma6qdB53xERGeWqpeu4wb-nNXzD8mIz3nQhWcMSTgt41nS--yDc-6bk7GwApdZhMBfULy3QoWCHi3_4lAgucpKaeGuQc6fDD04TUmePF5q9NGWefW9zx1PwdrzCw3Qh95GumM2NLjrByo0vkPV2GFUyT9HCY]

>>>>>>>>>>>>>>>Second Request
2021/03/26 18:19:20.221778 DEBUG RESTY 
==============================================================================
~~~ REQUEST ~~~
GET  /  HTTP/1.1
HOST   : www.google.com
HEADERS:
	User-Agent: go-resty/2.6.0 (https://github.com/go-resty/resty)
BODY   :
***** NO CONTENT *****
------------------------------------------------------------------------------
~~~ RESPONSE ~~~
STATUS       : 200 OK
PROTO        : HTTP/2.0
RECEIVED AT  : 2021-03-26T18:19:20.22169+08:00
TIME DURATION: 103.324114ms
HEADERS      :
	Alt-Svc: h3-29=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"
	Cache-Control: private, max-age=0
	Content-Type: text/html; charset=ISO-8859-1
	Date: Fri, 26 Mar 2021 10:19:20 GMT
	Expires: -1
	P3p: CP="This is not a P3P policy! See g.co/p3phelp for more info."
	Server: gws
	Set-Cookie: 1P_JAR=2021-03-26-10; expires=Sun, 25-Apr-2021 10:19:20 GMT; path=/; domain=.google.com; Secure, NID=212=xQp7SUGfjH-8K61-GEMUP35uGnLY2-MvVKs0sxKXcTyVgQOBkTdTgEF-QStgkNWeSHxMUmbHMevb6kbBaC6r1sRrZcTKsaRv2dKJDJAZAhWle9KpxoVNdUzPPtuWjov_eIFM1-5l0fHRKDaY6UdJ0ustUglABO-bEz-q2u3WApw; expires=Sat, 25-Sep-2021 10:19:20 GMT; path=/; domain=.google.com; HttpOnly
	X-Frame-Options: SAMEORIGIN
	X-Xss-Protection: 0
BODY         :
***** RESPONSE TOO LARGE (size - 14107) *****
==============================================================================

@gopkg-dev
Copy link

Is this problem solved?

@jeevatkm jeevatkm added bug and removed analysis labels Oct 1, 2023
@jeevatkm jeevatkm added this to the v2.10.0 milestone Oct 1, 2023
jeevatkm added a commit that referenced this issue Oct 8, 2023
fix: request debug log loss cookie header when cookiejar in use #424
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging a pull request may close this issue.

3 participants