-
Notifications
You must be signed in to change notification settings - Fork 1
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
Astrazione del body della request #9
Changes from 20 commits
69fd432
a135778
0069d75
413f9a4
714327e
93ae9bd
c269dea
17d17ab
23f8008
95fe821
078c147
5b0f5c6
65f7f84
919e2e5
34cc002
387ad61
aafd4b7
412ee6c
256b0b3
28165c9
cad6489
833c173
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
pub use super::errors::*; | ||
pub use super::{ | ||
request::{GraphQL, RequestType, Rest}, | ||
response::Response, | ||
v2::{DeliverableRequest, GraphQLRequest, Request, RestRequest}, | ||
Bridge, | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#[derive(Clone, Debug)] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. perché il body di una request dovrebbe essere clonabile? forse dovrebbe contenere solo un riferimento all'array di bytes There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. perchè credo che reqwest sotto si prenda l'ownership del body, quindi non posso passarlo per referenza.... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. prenderei in considerazione di consumare la
dove consumi la "nostra" request e ottieni un builder di reqwest in un colpo solo evitando diversi clone There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. interessante....da esplorare... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. è un po' un casino perchè nel trait ora ci sono le due implementazioni di |
||
pub struct Body { | ||
inner: Vec<u8>, | ||
} | ||
|
||
impl Default for Body { | ||
fn default() -> Self { | ||
Self { inner: vec![] } | ||
} | ||
} | ||
|
||
impl From<String> for Body { | ||
fn from(val: String) -> Self { | ||
Self { | ||
inner: val.into_bytes(), | ||
} | ||
} | ||
} | ||
|
||
impl From<&str> for Body { | ||
fn from(val: &str) -> Self { | ||
Self { | ||
inner: val.to_string().into_bytes(), | ||
} | ||
} | ||
} | ||
|
||
impl From<Vec<u8>> for Body { | ||
fn from(value: Vec<u8>) -> Self { | ||
Self { inner: value } | ||
} | ||
} | ||
|
||
impl From<Body> for Vec<u8> { | ||
fn from(body: Body) -> Self { | ||
body.inner | ||
} | ||
} |
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.
Così però chi usa la versione precedente importando dal
prelude
si rompe...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.
Vero! Ma siamo in versione 0.*, così forziamo l'update...