We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
json
Request
1 parent 1a86846 commit bb8e1cbCopy full SHA for bb8e1cb
packages/@pollyjs/core/src/-private/request.js
@@ -9,6 +9,7 @@ import removeHostFromUrl from '../utils/remove-host-from-url';
9
import serializeRequestBody from '../utils/serialize-request-body';
10
11
const { keys, freeze } = Object;
12
+const { parse } = JSON;
13
14
const PARSED_URL = Symbol();
15
const ROUTE = Symbol();
@@ -106,6 +107,10 @@ export default class PollyRequest {
106
107
return typeof this[ROUTE].handler.get('intercept') === 'function';
108
}
109
110
+ get json() {
111
+ return parse(this.body);
112
+ }
113
+
114
async setup() {
115
// Trigger the `beforeRequest` event
116
await this._trigger('beforeRequest');
0 commit comments