1 | ;
|
2 | // Copyright IBM Corp. and LoopBack contributors 2018. All Rights Reserved.
|
3 | // Node module: @loopback/rest
|
4 | // This file is licensed under the MIT License.
|
5 | // License text available at https://opensource.org/licenses/MIT
|
6 | Object.defineProperty(exports, "__esModule", { value: true });
|
7 | exports.StreamBodyParser = void 0;
|
8 | const body_parser_helpers_1 = require("./body-parser.helpers");
|
9 | /**
|
10 | * A special body parser to retain request stream as is.
|
11 | * It will be used by explicitly setting `x-parser` to `'stream'` in the request
|
12 | * body spec.
|
13 | */
|
14 | class StreamBodyParser {
|
15 | constructor() {
|
16 | this.name = body_parser_helpers_1.builtinParsers.stream;
|
17 | }
|
18 | supports(mediaType) {
|
19 | // Return `false` so that this parser can only be trigged by the
|
20 | // `{x-parser: 'stream'}` extension in the request body spec
|
21 | return false;
|
22 | }
|
23 | async parse(request) {
|
24 | return { value: request };
|
25 | }
|
26 | }
|
27 | exports.StreamBodyParser = StreamBodyParser;
|
28 | //# sourceMappingURL=body-parser.stream.js.map |
\ | No newline at end of file |