Skip to content

Adding response body in log#21

Open
mabaro3009 wants to merge 5 commits into
mainfrom
response_body
Open

Adding response body in log#21
mabaro3009 wants to merge 5 commits into
mainfrom
response_body

Conversation

@mabaro3009
Copy link
Copy Markdown

@mabaro3009 mabaro3009 commented Aug 1, 2022

https://www.notion.so/verseapp/obs-pkg-add-responseBody-618cd9b458de4fcdaaf243934b6c42eb

Was not sure how to approach this, ended up with a responseRecorder to later write the headers and body into the responseWriter. This is because I can't read the response from the responseWriter.

Also, added some example urls to test.

Screenshots below that show the response both in localhost and in the log:

OK

image
image

Error

image
image

With JSON response body

image
image

With no response body

image
image

Comment thread hlog/hlog.go Outdated
}
defer resp.Body.Close()
for k, v := range resp.Header {
w.Header()[k] = v
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we use w.Header().Add(...)?

@mabaro3009
Copy link
Copy Markdown
Author

Do not merge, need to take into account PII

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants