@@ -167,11 +167,6 @@ describe('header handling', () => {
167
167
168
168
request = new FetchRequest ( "get" , "localhost" )
169
169
expect ( request . fetchOptions . redirect ) . toBe ( "follow" )
170
-
171
- // maybe check for valid values and default to follow?
172
- // https://developer.mozilla.org/en-US/docs/Web/API/Request/redirect
173
- request = new FetchRequest ( "get" , "localhost" , { redirect : "nonsense" } )
174
- expect ( request . fetchOptions . redirect ) . toBe ( "nonsense" )
175
170
} )
176
171
177
172
test ( 'sets signal' , ( ) => {
@@ -196,10 +191,14 @@ describe('header handling', () => {
196
191
197
192
describe ( 'query params are parsed' , ( ) => {
198
193
test ( 'anchors are rejected' , ( ) => {
199
- const testRequest = new FetchRequest ( "post" , "localhost/test?a=1&b=2#anchor" , { query : { c : 3 } } )
200
- expect ( testRequest . url ) . toBe ( "localhost/test?a=1&b=2&c=3" )
201
- // const brokenRequest = new FetchRequest("post", "localhost/test#anchor", { query: { a: 1, b: 2, c: 3 } })
202
- // expect(brokenRequest.url).toBe("localhost/test?a=1&b=2&c=3")
194
+ const mixedRequest = new FetchRequest ( "post" , "localhost/test?a=1&b=2#anchor" , { query : { c : 3 } } )
195
+ expect ( mixedRequest . url ) . toBe ( "localhost/test?a=1&b=2&c=3" )
196
+
197
+ const queryRequest = new FetchRequest ( "post" , "localhost/test?a=1&b=2&c=3#anchor" )
198
+ expect ( queryRequest . url ) . toBe ( "localhost/test?a=1&b=2&c=3" )
199
+
200
+ const optionsRequest = new FetchRequest ( "post" , "localhost/test#anchor" , { query : { a : 1 , b : 2 , c : 3 } } )
201
+ expect ( optionsRequest . url ) . toBe ( "localhost/test?a=1&b=2&c=3" )
203
202
} )
204
203
test ( 'url and options are merged' , ( ) => {
205
204
const urlAndOptionRequest = new FetchRequest ( "post" , "localhost/test?a=1&b=2" , { query : { c : 3 } } )
0 commit comments