Skip to content

Commit

Permalink
Hotfix recorder
Browse files Browse the repository at this point in the history
  • Loading branch information
Ale Figueroa committed Mar 5, 2019
1 parent 5b8a8e5 commit 764ed9e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/Recorder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export class Recorder {
const fullUrl = new URL(req.url as string, this.host)
const { method = '', httpVersion, headers, trailers } = req

const bodyBuffer = Buffer.from(body)
const bodyBuffer = Buffer.concat(body)
const bodyEncoded = bodyBuffer.toString('base64')
const bodyHash = h64(bodyBuffer, 0).toString(16)

Expand All @@ -55,7 +55,7 @@ export class Recorder {
async serializeResponse (res: IncomingMessage) {
const statusCode = res.statusCode || 200
const headers = res.headers
const body = Buffer.from(await buffer<Buffer>(res)).toString('base64')
const body = Buffer.concat(await buffer<Buffer>(res)).toString('base64')
const trailers = res.trailers

return {
Expand Down
2 changes: 1 addition & 1 deletion src/db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export async function getDB (opts: YakTimeOpts) {
if (db == null) {
const dbPath = path.join(opts.dirname, 'tapes.json')
debug(`Opening db on ${dbPath}`)
db = new Loki(dbPath, { autoload: true, autosave: process.env.NODE_ENV !== 'test' })
db = new Loki(dbPath, { autoload: true, autosave: true })
}
return db
}

0 comments on commit 764ed9e

Please sign in to comment.