mirror of
https://github.com/sasjs/server.git
synced 2026-01-08 23:10:05 +00:00
fix: return buffer in case of file response
This commit is contained in:
@@ -4,14 +4,14 @@ export interface HTTPHeaders {
|
||||
[key: string]: string
|
||||
}
|
||||
|
||||
export const extractHeaders = (content: string): HTTPHeaders => {
|
||||
export const extractHeaders = (content?: string): HTTPHeaders => {
|
||||
const headersObj: HTTPHeaders = {}
|
||||
const headersArr = content
|
||||
.split('\n')
|
||||
?.split('\n')
|
||||
.map((line) => line.trim())
|
||||
.filter((line) => !!line)
|
||||
|
||||
headersArr.forEach((headerStr) => {
|
||||
headersArr?.forEach((headerStr) => {
|
||||
const [key, value] = headerStr.split(':').map((data) => data.trim())
|
||||
|
||||
if (value && headerUtils.validateHeader(key, value)) {
|
||||
|
||||
Reference in New Issue
Block a user