File tree Expand file tree Collapse file tree 1 file changed +10
-13
lines changed
packages/util-endpoints/src/utils Expand file tree Collapse file tree 1 file changed +10
-13
lines changed Original file line number Diff line number Diff line change @@ -3,16 +3,13 @@ import { EndpointError } from "../types";
33import { evaluateExpression } from "./evaluateExpression" ;
44
55export const getEndpointHeaders = ( headers : EndpointObjectHeaders , options : EvaluateOptions ) =>
6- Object . entries ( headers ) . reduce (
7- ( acc , [ headerKey , headerVal ] ) => ( {
8- ...acc ,
9- [ headerKey ] : headerVal . map ( ( headerValEntry ) => {
10- const processedExpr = evaluateExpression ( headerValEntry , "Header value entry" , options ) ;
11- if ( typeof processedExpr !== "string" ) {
12- throw new EndpointError ( `Header '${ headerKey } ' value '${ processedExpr } ' is not a string` ) ;
13- }
14- return processedExpr ;
15- } ) ,
16- } ) ,
17- { }
18- ) ;
6+ Object . entries ( headers ) . reduce ( ( acc , [ headerKey , headerVal ] ) => {
7+ acc [ headerKey ] = headerVal . map ( ( headerValEntry ) => {
8+ const processedExpr = evaluateExpression ( headerValEntry , "Header value entry" , options ) ;
9+ if ( typeof processedExpr !== "string" ) {
10+ throw new EndpointError ( `Header '${ headerKey } ' value '${ processedExpr } ' is not a string` ) ;
11+ }
12+ return processedExpr ;
13+ } ) ;
14+ return acc ;
15+ } , { } ) ;
You can’t perform that action at this time.
0 commit comments