tauri
tauri copied to clipboard
feat: support proxy options for http client
What kind of change does this PR introduce?
- [ ] Bugfix
- [x] Feature
- [ ] Docs
- [ ] New Binding issue #___
- [ ] Code style update
- [ ] Refactor
- [ ] Build-related changes
- [ ] Other, please describe:
Does this PR introduce a breaking change?
- [ ] Yes, and the changes were approved in issue #___
- [x] No
Checklist
- [ ] When resolving issues, they are referenced in the PR's title (e.g
fix: remove a typo, closes #___, #___) - [x] A change file is added if any packages will require a version bump due to this PR per the instructions in the readme.
- [ ] I have added a convincing reason for adding this feature, if necessary
Other information
This PR enhances the http api to support setting http proxy when building a client.
Usage:
import { getClient } from '@tauri-apps/api/http';
// simple form
let client = await getClient({
proxyUrl: 'http://localhost:1234',
});
// basic authentication form
let client = await getClient({
proxyUrl: 'http://localhost:1234',
proxyUser: 'foo',
proxyPassword: 'bar'
});
// no proxy form
let client = await getClient({
proxyUrl: 'http://localhost:1234',
noProxy: 'www.example.com',
});
These proxy options are supported for both reqwest-client and attohttpc features.