MCPcopy Create free account
hub / github.com/thinkjs/thinkjs / header

Function header

lib/extend/controller.js:193–207  ·  view source on GitHub ↗

* get or set header * @param {String} name * @param {Mixed} value

(name, value)

Source from the content-addressed store, hash-verified

191 * @param {Mixed} value
192 */
193 header(name, value) {
194 if (value === undefined && helper.isString(name)) {
195 return this.ctx.header[name];
196 }
197 if (this.ctx.res.headersSent) {
198 debug(`headers has already sent, url: ${this.ctx.url}`);
199 return;
200 }
201 if (value !== undefined) {
202 return this.ctx.set(name, value);
203 }
204 if (helper.isObject(name)) {
205 return this.ctx.set(name);
206 }
207 },
208 /**
209 * get referer header
210 */

Callers

nothing calls this directly

Calls 1

setMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…