Description
Description
When attempting to use a client's raw get/put/patch/head
methods directly, sometimes it's desirable to do this with a URL that you are unaware of the structure for (such as if your server is giving you a url to make a call to retrieve information from S3). There is no official documentation on this, but the api makes it look like it may be possibl via:
- Pass
{baseUrl: <your_url>, url: ''}
OR - Pass
{baseUrl: '', url: <your_url>}
Neither of these work because:
- If your url is an empty string, an automatic
/
gets appended to the end - If your baseUrl is an empty string, an automatic
/
gets prepended to the beginning
This makes it not possible to make a request where you want to take the whole url wholesale
Reproducible example or configuration
Using any generated client that has no config set
Using:
"@hey-api/client-fetch": "^0.10.1"
"@hey-api/openapi-ts": "^0.66.7",
import { createClient } from '@hey-api/client-fetch';
const client = createClient()
client.get({
baseUrl: 'https://google.com?q=stuff',
url:'',
})
interceptors.request.use((config) => {
console.log('url', config.url);
return config
});
See that the url has a traling slash, even though this would not be corrrect necessarily with query parameters
import { createClient } from '@hey-api/client-fetch';
const client = createClient()
client.get({
baseUrl: ''
url: 'https://google.com?q=stuff,',
})
interceptors.request.use((config) => {
console.log('url', config.url);
return config
});
See that the url has preceding slash
Is there a way to take the url wholesale and use it without adding slashes that isn't documented?
OpenAPI specification (optional)
No response
System information (optional)
No response