File tree 2 files changed +9
-3
lines changed
2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change 154
154
155
155
### url
156
156
157
- • ** url** : ` string ` \| () => ` string ` \| ` Promise ` <` string ` \>
157
+ • ** url** : ` string ` \| (` request ` : [ ` RequestParams ` ] ( RequestParams.md ) ) => ` string ` \| ` Promise ` <` string ` \>
158
158
159
159
URL of the GraphQL over HTTP server to connect.
160
160
@@ -164,3 +164,6 @@ resolves.
164
164
165
165
A good use-case for having a function is when using the URL for authentication,
166
166
where subsequent requests (due to auth) may have a refreshed identity token.
167
+
168
+ Function receives the request params. Useful for example, to ease up debugging and DevTools
169
+ navigation you might want to use the operation name in the URL's search params (` /graphql?MyQuery ` ).
Original file line number Diff line number Diff line change @@ -22,8 +22,11 @@ export interface ClientOptions {
22
22
*
23
23
* A good use-case for having a function is when using the URL for authentication,
24
24
* where subsequent requests (due to auth) may have a refreshed identity token.
25
+ *
26
+ * Function receives the request params. Useful for example, to ease up debugging and DevTools
27
+ * navigation you might want to use the operation name in the URL's search params (`/graphql?MyQuery`).
25
28
*/
26
- url : string | ( ( ) => Promise < string > | string ) ;
29
+ url : string | ( ( request : RequestParams ) => Promise < string > | string ) ;
27
30
/**
28
31
* Indicates whether the user agent should send cookies from the other domain in the case
29
32
* of cross-origin requests.
@@ -217,7 +220,7 @@ export function createClient(options: ClientOptions): Client {
217
220
try {
218
221
const url =
219
222
typeof options . url === 'function'
220
- ? await options . url ( )
223
+ ? await options . url ( request )
221
224
: options . url ;
222
225
if ( control . signal . aborted ) return ;
223
226
You can’t perform that action at this time.
0 commit comments