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

Add blocking API and change code structure to re-use reqwest::Client #19

Open
wants to merge 15 commits into
base: master
Choose a base branch
from

Conversation

Selyatin
Copy link

No description provided.

@fewensa
Copy link
Collaborator

fewensa commented Jun 25, 2022

Why remove header_map? For compatibility with older versions, I think this should be necessary, and it is possible that some graphql service providers require authentication. maybe you have a better reason?

@arthurkhlghatyan
Copy link
Owner

I agree with @fewensa this brings breaking changes to API, aside from that documentation doesn't seem to be updated. Need some time to check it out.

@arthurkhlghatyan arthurkhlghatyan self-assigned this Jun 25, 2022
@arthurkhlghatyan arthurkhlghatyan requested a review from fewensa June 25, 2022 18:53
@fewensa fewensa changed the base branch from development to master June 26, 2022 09:08
Client::builder()
.timeout(Duration::from_secs(5))
.build()
.unwrap()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please do not use unwrap. you can use map_err convert to GraphQLError and throw it. the unwrap will be panic.

like this

.map_err(|e| GraphQLError::with_text(format!("Can not create client: {:?}", e)))?,

Client::builder()
.default_headers(header_map)
.build()
.unwrap()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same here

}
}

pub fn new_with_headers(endpoint: impl AsRef<str>, headers: HashMap<&str, &str>) -> Self {
pub fn new_with_headers(endpoint: &'a str, headers: HashMap<&str, &str>) -> Self {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Sorry my mistake, I'm missing something here. header_map still exists. but there I suggest you still use impl AsRef<str>. because do this you can call this function use &str/String and or support AsRef<str> struct

@fewensa
Copy link
Collaborator

fewensa commented Jun 26, 2022

Please merge master branch, I think the development branch is not the main branch, nor will it be maintained for a long time, we should mainly maintain the master branch

@@ -33,14 +33,14 @@ pub enum GraphQLErrorPathParam {
}

impl GraphQLError {
pub fn with_text(message: impl AsRef<str>) -> Self {
pub fn from_str(message: &str) -> Self {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please merge master branch

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.

3 participants