npm install @canyuegongzi/decorator-http-template
nest angular HttpPost() post HttpHeader() json HttpResponseType() json HttpBaseUrl() HttpPostData() post HttpRes()
class TestHeader {
@HttpHeader('Content-Type: application/json')
@HttpBaseUrl('http://127.0.0.1:3000')
@HttpPost('/login')
@HttpResponseType('json')
public async test(@HttpPostData('username') postData, @HttpRes() res?) {
// res AxiosResponse res.data
// res
console.log(res);
return res.data;
}
}
const testInstance = new TestHeader()
const res = await testInstance.test({username: 'userName1', password: 123456});
HttpHeader
HttpPost post HttpPostData
HttpGet get HttpParams
HttpDelete delete
HttpGet options
HttpGet patch
HttpTransformRequest
HttpBaseUrl
HttpResponseType arraybuffer | blob | document | json | text |stream
HttpQuery
HttpParams
HttpPostData post
HttpRes AxiosResponse