api-def 0.6.2-alpha.4 → 0.7.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -127,13 +127,14 @@ var RequestContext = /** @class */ (function () {
127
127
  return this;
128
128
  };
129
129
  RequestContext.prototype.parseRequestBody = function () {
130
+ var _a;
130
131
  if (this.computedConfig.body && this.computedConfig.headers) {
131
132
  var contentTypeKey = Object.keys(this.computedConfig.headers).find(function (key) { return key.toLowerCase() === "content-type"; });
132
- var contentType = contentTypeKey && this.computedConfig.headers[contentTypeKey];
133
- if (typeof contentType === "string" && contentType.toLowerCase() === "multipart/form-data") {
133
+ var contentType = contentTypeKey && ((_a = this.computedConfig.headers[contentTypeKey]) === null || _a === void 0 ? void 0 : _a.toString());
134
+ if (contentType === "application/x-www-form-urlencoded") {
134
135
  var searchParams = new url_1.URLSearchParams();
135
- for (var _i = 0, _a = Object.keys(this.computedConfig.body); _i < _a.length; _i++) {
136
- var key = _a[_i];
136
+ for (var _i = 0, _b = Object.keys(this.computedConfig.body); _i < _b.length; _i++) {
137
+ var key = _b[_i];
137
138
  var value = this.computedConfig.body[key];
138
139
  searchParams.append(key, value === null || value === void 0 ? void 0 : value.toString());
139
140
  }
@@ -125,13 +125,14 @@ var RequestContext = /** @class */ (function () {
125
125
  return this;
126
126
  };
127
127
  RequestContext.prototype.parseRequestBody = function () {
128
+ var _a;
128
129
  if (this.computedConfig.body && this.computedConfig.headers) {
129
130
  var contentTypeKey = Object.keys(this.computedConfig.headers).find(function (key) { return key.toLowerCase() === "content-type"; });
130
- var contentType = contentTypeKey && this.computedConfig.headers[contentTypeKey];
131
- if (typeof contentType === "string" && contentType.toLowerCase() === "multipart/form-data") {
131
+ var contentType = contentTypeKey && ((_a = this.computedConfig.headers[contentTypeKey]) === null || _a === void 0 ? void 0 : _a.toString());
132
+ if (contentType === "application/x-www-form-urlencoded") {
132
133
  var searchParams = new URLSearchParams();
133
- for (var _i = 0, _a = Object.keys(this.computedConfig.body); _i < _a.length; _i++) {
134
- var key = _a[_i];
134
+ for (var _i = 0, _b = Object.keys(this.computedConfig.body); _i < _b.length; _i++) {
135
+ var key = _b[_i];
135
136
  var value = this.computedConfig.body[key];
136
137
  searchParams.append(key, value === null || value === void 0 ? void 0 : value.toString());
137
138
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "api-def",
3
- "version": "0.6.2-alpha.4",
3
+ "version": "0.7.0-alpha.1",
4
4
  "description": "Typed API definitions with middleware support",
5
5
  "main": "cjs/index.js",
6
6
  "types": "esm/index.d.ts",