| 92 | } |
| 93 | |
| 94 | function buildRequest(spec) { |
| 95 | // DummyRequest is an http.IncomingMessage stream that emits 'end' |
| 96 | // synchronously. We need that because callApiMethod's waterfall |
| 97 | // waits for the request body on non-objectPut paths. |
| 98 | return new DummyRequest({ |
| 99 | bucketName, |
| 100 | objectKey: spec.objectKey, |
| 101 | headers: { |
| 102 | host: `${bucketName}.s3.amazonaws.com`, |
| 103 | origin, |
| 104 | }, |
| 105 | url: spec.url, |
| 106 | query: spec.query, |
| 107 | method: spec.httpMethod, |
| 108 | }, Buffer.alloc(0)); |
| 109 | } |
| 110 | |
| 111 | function buildResponseSpy(sandbox) { |
| 112 | const headers = {}; |