()
| 160 | } |
| 161 | |
| 162 | async put() { |
| 163 | const ctx = this.ctx; |
| 164 | const result = await ctx.curl('https://httpbin.org/put', { |
| 165 | // 必须指定 method |
| 166 | method: 'PUT', |
| 167 | // 通过 contentType 告诉 httpclient 以 JSON 格式发送 |
| 168 | contentType: 'json', |
| 169 | data: { |
| 170 | update: 'foo bar', |
| 171 | }, |
| 172 | // 明确告诉 httpclient 以 JSON 格式处理响应 body |
| 173 | dataType: 'json', |
| 174 | }); |
| 175 | ctx.body = result.data; |
| 176 | } |
| 177 | |
| 178 | async stream() { |
| 179 | const ctx = this.ctx; |
no outgoing calls
no test coverage detected