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

doc: Add note on how to use builder style in build.rs and how to injec… #1100

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Tuurlijk
Copy link

Add note on how to use builder style in build.rs and how to inject default headers into the client

Copy link
Collaborator

@ahl ahl left a comment

Choose a reason for hiding this comment

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

This is awesome and very much appreciated. One question and two suggestions for you. Thank you for the contribution!


## Changing default client settings

Currently, the generated code doesn't deal with request headers. To add default headers to all requests, you can use the default_headers method when constructing the Client.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does it not? This is useful regardless, but I thought we accepted header parameters.

Copy link
Author

Choose a reason for hiding this comment

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

I don't see any header autocomplete options pop up when using the Builder Interfacestyle generated api.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Are we talking about parameters to operations that are "in": "header"? Or are you talking about the ability to set headers on specific requests e.g. client.foo().set_header("bar", "baz").send().await?

Copy link
Author

Choose a reason for hiding this comment

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

I need to seat a bearer token for each request.

README.md Outdated
```rust
let baseurl = "https://company.com/api/v2";

let access_token = "OP7nhQY46jf3I2sqyTZBHWEOIRsldfWEFlkjRkrjlER";
Copy link
Collaborator

Choose a reason for hiding this comment

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

would it make sense to have an example that reads an environment variable to encourage people not to accidentally leak credentials?

Tuurlijk and others added 2 commits March 26, 2025 18:53
Co-authored-by: Adam Leventhal <adam.leventhal@gmail.com>
Co-authored-by: Adam Leventhal <adam.leventhal@gmail.com>
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