-
Notifications
You must be signed in to change notification settings - Fork 475
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BUGFIX: Cannot set statuscode for express.js #94
- Loading branch information
1 parent
d5808c5
commit 804ed90
Showing
14 changed files
with
440 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { | ||
Route, Get, Controller | ||
} from '../../../src'; | ||
import { TestModel } from '../../fixtures/testModel'; | ||
import { ModelService } from '../services/modelService'; | ||
|
||
@Route('Controller') | ||
export class TestController extends Controller { | ||
|
||
@Get('normalStatusCode') | ||
public async normalStatusCode(): Promise<TestModel> { | ||
return Promise.resolve(new ModelService().getModel()); | ||
} | ||
|
||
@Get('customNomalStatusCode') | ||
public async customNomalStatusCode(): Promise<TestModel> { | ||
const that = this; | ||
const service = new ModelService(); | ||
const promise = service.getModelPromise(); | ||
|
||
return new Promise<TestModel>(resolve => { | ||
that.statusCode = 201; | ||
resolve(promise); | ||
}); | ||
} | ||
|
||
@Get('noContentStatusCode') | ||
public async noContentStatusCode(): Promise<void> { | ||
return Promise.resolve(); | ||
} | ||
|
||
@Get('customNoContentStatusCode') | ||
public async customNoContentStatusCode(): Promise<void> { | ||
const that = this; | ||
const promise = Promise.resolve(); | ||
|
||
return new Promise<void>(resolve => { | ||
that.statusCode = 201; | ||
resolve(promise); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.