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

Body NewRequest #71

Merged
merged 1 commit into from
Jan 4, 2023
Merged

Body NewRequest #71

merged 1 commit into from
Jan 4, 2023

Conversation

mgutijae
Copy link
Contributor

Add body on NewRequest, not nil

Add body on NewRequest, not nil
@aldas
Copy link
Contributor

aldas commented Jan 27, 2022

Please add tests and explanation what problem and how this change fixes.

@mgutijae
Copy link
Contributor Author

Currently, one of the parameters that the function has is the body, but this parameter is never used inside the method. Instead, a nil value is pass into NewRequest function. I think this is a bug and just request without body can be handled.

@mgutijae
Copy link
Contributor Author

No tests are required for this change

@m1x0n
Copy link
Contributor

m1x0n commented Jun 19, 2022

Good catch @mgutijae. The issue is easy to reproduce. Just create traced request for HTTP POST and try to send it via http.Client. You will propagate only tracing headers but request will definitely miss body.

@m1x0n m1x0n mentioned this pull request Jun 30, 2022
@aldas
Copy link
Contributor

aldas commented Jun 30, 2022

Could someone wit actual jaeger instance confirm that it works and I'll merge this PR.

@m1x0n
Copy link
Contributor

m1x0n commented Jul 1, 2022

Could someone wit actual jaeger instance confirm that it works and I'll merge this PR.

Sure. I can check this.

@m1x0n
Copy link
Contributor

m1x0n commented Jul 1, 2022

@aldas I did a small concept to prove the fix is working: https://github.com/m1x0n/echo-jaeger/blob/master/srv.go
Results:

~ curl -i http://localhost:1337/broken
HTTP/1.1 400 Bad Request
Content-Type: text/plain; charset=UTF-8
Date: Fri, 01 Jul 2022 12:17:11 GMT
Content-Length: 25

Received: Body is missing%

~ curl -i http://localhost:1337/fixed
HTTP/1.1 200 OK
Content-Type: text/plain; charset=UTF-8
Date: Fri, 01 Jul 2022 12:17:21 GMT
Content-Length: 35

Received: Body is OK: Hello jaeger!%

Jaeger UI:
image
image

Also can be checked by bytes_in/bytes_out

echo-jaeger-app-1     | {"time":"2022-07-01T12:17:11.984625937Z","id":"","remote_ip":"127.0.0.1","host":"0.0.0.0:1337","method":"POST","uri":"/body","user_agent":"Go-http-client/1.1","status":400,"error":"","latency":56325,"latency_human":"56.325µs","bytes_in":0,"bytes_out":15}
echo-jaeger-app-1     | {"time":"2022-07-01T12:17:11.985125846Z","id":"","remote_ip":"172.18.0.1","host":"localhost:1337","method":"GET","uri":"/broken","user_agent":"curl/7.79.1","status":400,"error":"","latency":1012973,"latency_human":"1.012973ms","bytes_in":0,"bytes_out":25}
echo-jaeger-app-1     | {"time":"2022-07-01T12:17:21.194249831Z","id":"","remote_ip":"127.0.0.1","host":"0.0.0.0:1337","method":"POST","uri":"/body","user_agent":"Go-http-client/1.1","status":200,"error":"","latency":70114,"latency_human":"70.114µs","bytes_in":13,"bytes_out":25}
echo-jaeger-app-1     | {"time":"2022-07-01T12:17:21.19520424Z","id":"","remote_ip":"172.18.0.1","host":"localhost:1337","method":"GET","uri":"/fixed","user_agent":"curl/7.79.1","status":200,"error":"","latency":1641885,"latency_human":"1.641885ms","bytes_in":0,"bytes_out":35}

@m1x0n
Copy link
Contributor

m1x0n commented Jan 4, 2023

@aldas The issue is still relevant. Are there any other checks we need to add to get fix merged?

@aldas aldas merged commit bba49a2 into labstack:master Jan 4, 2023
@aldas
Copy link
Contributor

aldas commented Jan 4, 2023

Sorry, I totally forgot. It is now merged and I tagged a new release for it v0.13.1

@m1x0n
Copy link
Contributor

m1x0n commented Jan 4, 2023

Great! Thank you.

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.

None yet

3 participants