Skip to content

Commit

Permalink
refactor: replace printBlankLine
Browse files Browse the repository at this point in the history
  • Loading branch information
dnalborczyk committed Jul 1, 2022
1 parent f88352a commit b82028f
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions src/events/http/HttpServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,12 +234,6 @@ export default class HttpServer {
// return this.#server.listener
// }

#printBlankLine() {
if (env.NODE_ENV !== 'test') {
log.notice()
}
}

#logPluginIssue() {
log.notice(
'If you think this is an issue with the plugin please submit it, thanks!\nhttps://github.com/dherault/serverless-offline/issues',
Expand Down Expand Up @@ -552,7 +546,7 @@ export default class HttpServer {
request.rawPayload = request.payload

// Incomming request message
this.#printBlankLine()
log.notice()

log.notice()
log.notice(`${method} ${request.path} (λ: ${functionKey})`)
Expand Down Expand Up @@ -829,15 +823,15 @@ export default class HttpServer {
headerValue = headerValue.toString()
}
} else {
this.#printBlankLine()
log.notice()

log.warning()
log.warning(
`Offline plugin only supports "integration.response.body[.JSON_path]" right-hand responseParameter. Found "${value}" (for "${key}"") instead. Skipping.`,
)

this.#logPluginIssue()
this.#printBlankLine()
log.notice()
}
} else {
headerValue = value.match(/^'.*'$/) ? value.slice(1, -1) : value // See #34
Expand All @@ -855,15 +849,15 @@ export default class HttpServer {
response.header(headerName, headerValue)
}
} else {
this.#printBlankLine()
log.notice()

log.warning()
log.warning(
`Offline plugin only supports "method.response.header.PARAM_NAME" left-hand responseParameter. Found "${key}" instead. Skipping.`,
)

this.#logPluginIssue()
this.#printBlankLine()
log.notice()
}
})
}
Expand Down Expand Up @@ -924,7 +918,7 @@ export default class HttpServer {
}

if (!chosenResponse.statusCode) {
this.#printBlankLine()
log.notice()

log.warning()
log.warning(`No statusCode found for response "${responseName}".`)
Expand Down Expand Up @@ -1119,7 +1113,7 @@ export default class HttpServer {
return
}

this.#printBlankLine()
log.notice()

log.notice()
log.notice('Routes defined in resources:')
Expand Down

0 comments on commit b82028f

Please sign in to comment.