This repository has been archived by the owner on Nov 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 280
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Uses Base64 encoding as the serialization, which allows also non-JS hooks to set request/response bodies to a binary content. Close #617 Close #87 Close #836
- Loading branch information
1 parent
514d2ff
commit d5414b3
Showing
10 changed files
with
68 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
const hooks = require('hooks'); | ||
|
||
hooks.beforeEach((transaction, done) => { | ||
transaction.request.body = Buffer.from([0xFF, 0xEF, 0xBF, 0xBE]).toString(); | ||
transaction.request.body = Buffer.from([0xFF, 0xEF, 0xBF, 0xBE]).toString('base64'); | ||
transaction.request.bodyEncoding = 'base64'; | ||
done(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,9 @@ | ||
const hooks = require('hooks'); | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
const { assert } = require('chai'); | ||
|
||
hooks.beforeEachValidation((transaction, done) => { | ||
const buffer = fs.readFileSync(path.join(__dirname, '../image.png')); | ||
assert.equal(transaction.real.body, buffer.toString()); | ||
const bytes = fs.readFileSync(path.join(__dirname, '../image.png')); | ||
transaction.expected.body = bytes.toString('base64'); | ||
done(); | ||
}); |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters