Skip to content

Commit

Permalink
fix: remove redundant code
Browse files Browse the repository at this point in the history
  • Loading branch information
fletcherist committed Aug 12, 2018
1 parent 729b7db commit 380de2a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/alice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,9 @@ export class Alice implements IAlice {
if (data.version !== ALICE_PROTOCOL_VERSION) {
throw new Error('Unknown protocol version');
}
debug('>> ', data.request.command);
debug(`incoming request: ${data.request.command}`);
const context = this._buildContext(data);
const result = await this._runMiddlewares(context);
debug('result', result);
if (!result) {
throw new Error(
'No response for request ' +
Expand All @@ -91,6 +90,7 @@ export class Alice implements IAlice {
);
}

debug(`outcoming result: ${result.responseBody.text}`);
return {
response: result.responseBody,
session: {
Expand Down
2 changes: 0 additions & 2 deletions src/server/webhookServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,10 @@ export class WebhookServer {
request: http.IncomingMessage,
response: http.ServerResponse,
): Promise<void> {
debug('incoming request');
if (!isAvailableMethod(request.method) || request.url !== this.webhookUrl) {
response.statusCode = 400;
return response.end();
}
debug('good request');

const requestBody = await WebhookServer._readRequest(request);
const responseBody = await this._handleAliceRequest(requestBody);
Expand Down

0 comments on commit 380de2a

Please sign in to comment.