Skip to content

Commit

Permalink
fix(ClientRequest): spread object args to support "follow-redirects" (#…
Browse files Browse the repository at this point in the history
…541)

Co-authored-by: Michael Solomon <[email protected]>
  • Loading branch information
kettanaito and Michael Solomon authored Mar 30, 2024
1 parent 2b1a5d7 commit 3348dd7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ it('handles [RequestOptions, callback] input', () => {
expect(url.href).toEqual('https://mswjs.io/resource')

// Request options must be preserved.
expect(options).toEqual(initialOptions)
expect(options).toMatchObject(initialOptions)

// Callback must be preserved.
expect(callback).toBeTypeOf('function')
Expand Down Expand Up @@ -320,7 +320,7 @@ it('handles [PartialRequestOptions, callback] input', () => {
)

// Request options must be preserved.
expect(options).toEqual(initialOptions)
expect(options).toMatchObject(initialOptions)

// Options protocol must be inferred from the request issuing module.
expect(options.protocol).toEqual('https:')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ export function normalizeClientRequestArgs(
// Handle a given "RequestOptions" object as-is
// and derive the URL instance from it.
else if (isObject(args[0])) {
options = args[0] as any
options = { ... args[0] as any }
logger.info('first argument is RequestOptions:', options)

// When handling a "RequestOptions" object without an explicit "protocol",
Expand Down
2 changes: 1 addition & 1 deletion test/third-party/follow-redirect-http.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ afterAll(async () => {
await server.close()
})

it.skip('intercepts a POST request issued by "follow-redirects"', async () => {
it('intercepts a POST request issued by "follow-redirects"', async () => {
const { address } = server.https
const payload = JSON.stringify({ todo: 'Buy the milk' })

Expand Down

0 comments on commit 3348dd7

Please sign in to comment.