Skip to content

Commit

Permalink
fix: add target parameter (#1139)
Browse files Browse the repository at this point in the history
  • Loading branch information
czy88840616 authored Jul 6, 2021
1 parent 9e0e7e5 commit 5be4757
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
8 changes: 4 additions & 4 deletions packages-serverless/serverless-http-parser/src/http/req.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ const EVENT_PARSED = Symbol.for('ctx#event_parsed');
const BODY = Symbol.for('ctx#body');

export class HTTPRequest {
private originContext;
private originEvent;
private readonly originContext;
private readonly originEvent;
public bodyParsed = false;

constructor(event, context) {
Expand Down Expand Up @@ -52,8 +52,8 @@ export class HTTPRequest {

get url() {
if (!this[EVENT].url) {
const querystirng = (qs as any).stringify(this.query || {});
this[EVENT].url = this.path + (querystirng ? '?' + querystirng : '');
const querystring = (qs as any).stringify(this.query || {});
this[EVENT].url = this.path + (querystring ? '?' + querystring : '');
}
return this[EVENT].url;
}
Expand Down
5 changes: 3 additions & 2 deletions packages/core/src/service/configService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export class MidwayConfigService implements IConfigService {
// merge set
const target = {};
for (const filename of [...defaultSet, ...currentEnvSet]) {
const config = await this.loadConfig(filename);
const config = await this.loadConfig(filename, target);

if (!config) {
continue;
Expand Down Expand Up @@ -113,7 +113,7 @@ export class MidwayConfigService implements IConfigService {
return this.configuration;
}

async loadConfig(configFilename): Promise<Record<string, unknown>> {
async loadConfig(configFilename, target?): Promise<Record<string, unknown>> {
debug('load config %s.', configFilename);
let exports = require(configFilename);
if (exports && exports['default'] && Object.keys(exports).length === 1) {
Expand All @@ -132,6 +132,7 @@ export class MidwayConfigService implements IConfigService {
HOME: informationService.getHome(),
root: informationService.getRoot(),
},
target,
]);
}
return result;
Expand Down

0 comments on commit 5be4757

Please sign in to comment.