-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat: add JSON request/response support #80
Conversation
Codecov ReportAttention: Patch coverage is
Flags with carried forward coverage won't be shown. Click here to find out more.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
flareon/src/response.rs
Outdated
); | ||
match &response.body().inner { | ||
BodyInner::Fixed(fixed) => { | ||
assert_eq!(fixed, "{\"hello\":\"world\"}"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: in another place, we're using r#"{"hello":"world"}"#
for that case. It would be nice to represent it in one way
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair
*request.body_mut() = Body::fixed(json_data.clone()); | ||
request.headers_mut().insert( | ||
http::header::CONTENT_TYPE, | ||
http::HeaderValue::from_static("application/json"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use flareon::headers::JSON_CONTENT_TYPE
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a good practice not to use any data used by production code in tests. This might be overdoing stuff (after all, it's just a well-known constant), but this prevents tests from passing when, for instance, the constant would be refactored and modified by a mistake.
No description provided.