UNPKG

mappersmith

Version:

It is a lightweight rest client for node.js and the browser

1 lines 1.32 kB
{"version":3,"sources":["../../../src/test/request-factory.ts"],"sourcesContent":["import { Request, RequestContext } from '../request'\nimport type { RequestParams } from '../types'\nimport { MethodDescriptor } from '../method-descriptor'\n\nexport interface RequestFactoryArgs extends RequestParams {\n method?: string\n path?: string\n context?: RequestContext\n}\n\n/**\n * Create a request to use in tests\n * @returns Request\n */\nexport const requestFactory = ({\n method = 'GET',\n host = 'http://example.org',\n path = '/path',\n auth,\n body,\n headers,\n params,\n timeout,\n context,\n ...rest\n}: RequestFactoryArgs = {}) => {\n const methodDescriptor = new MethodDescriptor({ method, host, path })\n return new Request(\n methodDescriptor,\n {\n auth,\n body,\n headers,\n params,\n timeout,\n ...rest,\n },\n context\n )\n}\n"],"mappings":";AAAA,SAAS,eAA+B;AAExC,SAAS,wBAAwB;AAY1B,IAAM,iBAAiB,CAAC;AAAA,EAC7B,SAAS;AAAA,EACT,OAAO;AAAA,EACP,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,IAAwB,CAAC,MAAM;AAC7B,QAAM,mBAAmB,IAAI,iBAAiB,EAAE,QAAQ,MAAM,KAAK,CAAC;AACpE,SAAO,IAAI;AAAA,IACT;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,GAAG;AAAA,IACL;AAAA,IACA;AAAA,EACF;AACF;","names":[]}