Skip to content

Commit

Permalink
Default text body
Browse files Browse the repository at this point in the history
  • Loading branch information
GDownes committed Oct 17, 2023
1 parent 6a3c938 commit 1cdb85b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/mapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export class Method {
const responseTypeName = responseType?.substring(responseType?.lastIndexOf('/') + 1);
return `json(body: Model.${responseTypeName}, headers?: {${headerParam}}): APIGatewayProxyResult`;
} else if (contentType === 'application/text') {
return `text(body: string, headers?: {${headerParam}}): APIGatewayProxyResult`;
return `text(body = '', headers?: {${headerParam}}): APIGatewayProxyResult`;
}
return `['${contentType}'](body: string, headers?: {${headerParam}}): APIGatewayProxyResult`;
});
Expand All @@ -78,9 +78,9 @@ export class Method {
const responseTypeName = responseType?.substring(responseType?.lastIndexOf('/') + 1);
return `json(body: Model.${responseTypeName}, headers?: {${headerParam}}): APIGatewayProxyResult { return { statusCode: ${statusCode}, body: JSON.stringify(body), headers: { ...(headers ?? {}), ['Content-Type']: '${contentType}' } } }`;
} else if (contentType === 'application/text') {
return `text(body: string, headers?: {${headerParam}}): APIGatewayProxyResult { return { statusCode: ${statusCode}, body, headers: { ...(headers ?? {}), ['Content-Type']: '${contentType}' } } }`;
return `text(body = '', headers?: {${headerParam}}): APIGatewayProxyResult { return { statusCode: ${statusCode}, body, headers: { ...(headers ?? {}), ['Content-Type']: '${contentType}' } } }`;
}
return `['${contentType}'](body: string, headers?: {${headerParam}}): APIGatewayProxyResult { return { statusCode: ${statusCode}, body, headers: { ...(headers ?? {}), ['Content-Type']: '${contentType}' } } }`;
return `['${contentType}'](body = '', headers?: {${headerParam}}): APIGatewayProxyResult { return { statusCode: ${statusCode}, body, headers: { ...(headers ?? {}), ['Content-Type']: '${contentType}' } } }`;
});
return `[${statusCode}]: { ${responses.join(', ')} }`;
}).join(', ');
Expand Down

0 comments on commit 1cdb85b

Please sign in to comment.