@@ -3,12 +3,13 @@ import { stripVTControlCharacters } from 'node:util'
33import { readFileSync } from 'node:fs'
44import path from 'node:path'
55import { type Action } from '../support/Actor.mjs'
6- import { type PublishResult } from './types'
6+ import { type RequestComposer , type PublishResult } from './types'
77
8- export const publishReport : ( fixture : string , privateToken ?: string ) => Action < PublishResult > = (
9- fixture ,
10- privateToken
11- ) => {
8+ export const publishReport : (
9+ fixture : string ,
10+ requestComposer : RequestComposer ,
11+ privateToken ?: string
12+ ) => Action < PublishResult > = ( fixture , requestComposer , privateToken ) => {
1213 return async ( ) => {
1314 const headers = new Headers ( )
1415 if ( privateToken ) {
@@ -23,14 +24,11 @@ export const publishReport: (fixture: string, privateToken?: string) => Action<P
2324 const url = banner . split ( ' ' ) . find ( ( part ) => part . startsWith ( 'http' ) )
2425
2526 if ( getResponse . ok && url ) {
26- const putUrl = getResponse . headers . get ( 'Location' ) as string
27+ const uploadUrl = getResponse . headers . get ( 'Location' ) as string
2728 const envelopes = readFileSync ( path . join ( import . meta. dirname , '..' , 'fixtures' , fixture ) , {
2829 encoding : 'utf-8' ,
2930 } )
30- const putResponse = await fetch ( putUrl , {
31- method : 'PUT' ,
32- body : envelopes ,
33- } )
31+ const putResponse = await fetch ( uploadUrl , requestComposer ( envelopes ) )
3432 assert . ok ( putResponse . ok )
3533 }
3634
0 commit comments