Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions src/components/compatibility/ExpressRequest.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';
const Negotiator = require('negotiator')
const mime_types = require('mime-types')
const Negotiator = require('negotiator');
const mime_types = require('mime-types');
const parse_range = require('range-parser');
const type_is = require('type-is');
const is_ip = require('net').isIP;
Expand Down Expand Up @@ -39,7 +39,7 @@ class ExpressRequest {
return this.#negotiator.mediaTypes();
}

const mimes = arrayTypes.map((type) => type.indexOf('/') === -1 ? mime_types.lookup(type) : type);
const mimes = arrayTypes.map((type) => (type.indexOf('/') === -1 ? mime_types.lookup(type) : type));
const first = this.#negotiator.mediaType(mimes.filter((type) => typeof type === 'string'));
return first ? arrayTypes[mimes.indexOf(first)] : false;
}
Expand Down Expand Up @@ -177,6 +177,11 @@ class ExpressRequest {
return this.query_parameters;
}

set query(value) {
this.query_parameters = value;
return this.query_parameters;
}

get secure() {
return this.protocol === 'https';
}
Expand Down
9 changes: 9 additions & 0 deletions src/components/http/Request.js
Original file line number Diff line number Diff line change
Expand Up @@ -879,6 +879,15 @@ class Request {
this._query_parameters = querystring.parse(this._query);
return this._query_parameters;
}
/**
* Sets query parameters for incoming request.
* @param {Object.<string, string>} value
* @returns {Object.<string, string>}
*/
set query_parameters(value) {
this._query_parameters = value;
return this._query_parameters;
}

/**
* Returns remote IP address in string format from incoming request.
Expand Down