MCPcopy
hub / github.com/thinkjs/thinkjs / jsonp

Function jsonp

lib/extend/context.js:81–91  ·  view source on GitHub ↗

* send jsonp data

(data, callbackField = this.config('jsonpCallbackField'))

Source from the content-addressed store, hash-verified

79 * send jsonp data
80 */
81 jsonp(data, callbackField = this.config('jsonpCallbackField')) {
82 let field = this.param(callbackField);
83 // remove unsafe chars
84 field = (field || '').replace(/[^\w.]/g, '');
85 if (field) {
86 data = `${field}(${JSON.stringify(data)})`;
87 }
88 this.type = this.config('jsonpContentType');
89 this.body = data;
90 return false;
91 },
92 /**
93 * send json data
94 */

Callers

nothing calls this directly

Calls 2

configMethod · 0.80
paramMethod · 0.65

Tested by

no test coverage detected