Compare commits

...

7 Commits

Author SHA1 Message Date
51219303a9 1.0.22 2019-08-31 23:15:05 +02:00
ccc9303c63 fix(core): update 2019-08-31 23:15:05 +02:00
69b7147ae7 1.0.21 2019-08-31 23:14:47 +02:00
3667946b2f fix(core): update 2019-08-31 23:14:46 +02:00
aef1e6183c 1.0.20 2019-08-31 23:05:37 +02:00
68526888e7 1.0.19 2019-08-31 23:04:37 +02:00
54d4851de1 fix(core): update 2019-08-31 23:04:37 +02:00
5 changed files with 1201 additions and 7 deletions

1175
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{
"name": "@apiglobal/typedrequest",
"version": "1.0.18",
"version": "1.0.22",
"private": false,
"description": "make typed requests towards apis",
"main": "dist/index.js",
@ -15,6 +15,7 @@
"devDependencies": {
"@gitzone/tsbuild": "^2.0.22",
"@gitzone/tstest": "^1.0.15",
"@pushrocks/smartexpress": "^3.0.40",
"@pushrocks/tapbundle": "^3.0.13",
"@types/node": "^12.7.2",
"tslint": "^5.19.0",

View File

@ -1,8 +1,28 @@
import { expect, tap } from '@pushrocks/tapbundle';
import * as smartexpress from '@pushrocks/smartexpress';
import * as typedrequest from '../ts/index';
tap.test('first test', async () => {
typedrequest.TypedRequest;
let testServer: smartexpress.Server;
tap.test('should spawn a server to test with', async () => {
testServer = new smartexpress.Server({
cors: true,
forceSsl: false,
port: 3000
});
});
tap.test('should define a testHandler', async () => {
});
tap.test('should start the server', async () => {
await testServer.start();
});
tap.test('should end the server', async () => {
await testServer.stop();
});
tap.start();

View File

@ -16,11 +16,11 @@ export class TypedRequest<T extends plugins.typedRequestInterfaces.ITypedRequest
public async fire(fireArg: T['request']): Promise<T['response']> {
const response = await plugins.smartrequest.request(this.urlEndPoint, {
method: 'POST',
requestBody: {
requestBody: JSON.stringify({
method: this.method,
request: fireArg,
response: null
}
})
});
return response.body.response;
}

View File

@ -27,7 +27,7 @@ export class TypedRouter {
if (!typedHandler) {
const availableMethods: string[] = [];
this.handlerMap.forEach(async (handler) => {
await this.handlerMap.forEach(async (handler) => {
availableMethods.push(handler.method);
});
console.log(`Cannot find method for ${typedHandler}`);