Skip to content

Commit ce72674

Browse files
remove key value
1 parent 896cd5f commit ce72674

File tree

3 files changed

+7
-18
lines changed

3 files changed

+7
-18
lines changed

src/lib/processSnapshot.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,8 +270,10 @@ export default async function processSnapshot(snapshot: Snapshot, ctx: Context):
270270
requestOptions.headers.Authorization = `Basic ${token}`;
271271
}
272272
if (ctx.config.requestHeaders && Array.isArray(ctx.config.requestHeaders)) {
273-
ctx.config.requestHeaders.forEach((header: { key: string, value: string }) => {
274-
requestOptions.headers[header.key] = header.value;
273+
ctx.config.requestHeaders.forEach((headerObj) => {
274+
Object.entries(headerObj).forEach(([key, value]) => {
275+
requestOptions.headers[key] = value;
276+
});
275277
});
276278
}
277279

src/lib/schemaValidation.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -252,16 +252,8 @@ const ConfigSchema = {
252252
type: "array",
253253
items: {
254254
type: "object",
255-
properties: {
256-
key: {
257-
type: "string",
258-
errorMessage: "Invalid config; key is mandatory"
259-
},
260-
value: {
261-
type: "string",
262-
errorMessage: "Invalid config; value is mandatory"
263-
},
264-
}
255+
minProperties: 1,
256+
additionalProperties: { type: "string" }
265257
},
266258
uniqueItems: true,
267259
errorMessage: {

src/types.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export interface Context {
3535
skipBuildCreation?: boolean;
3636
tunnel: tunnelConfig | undefined;
3737
userAgent?: string;
38-
requestHeaders?: Array<reqHeaders>;
38+
requestHeaders?: Array<Record<string, string>>;
3939
};
4040
uploadFilePath: string;
4141
webStaticConfig: WebStaticConfig;
@@ -208,11 +208,6 @@ export interface basicAuth {
208208
password: string;
209209
}
210210

211-
export interface reqHeaders {
212-
key: string;
213-
value: string;
214-
}
215-
216211
export interface tunnelConfig {
217212
type: string;
218213
tunnelName: string;

0 commit comments

Comments
 (0)