MCPcopy
hub / github.com/eggjs/examples / put

Method put

httpclient/app/controller/httpclient.js:162–176  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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;

Callers 3

home.test.jsFile · 0.80
main.jsFile · 0.80
topics.test.jsFile · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected