MCPcopy Index your code
hub / github.com/NobyDa/Script / post

Function post

JD-DailyBonus/JD_DailyBonus.js:1896–1936  ·  view source on GitHub ↗
(options, callback)

Source from the content-addressed store, hash-verified

1894 }
1895 }
1896 const post = (options, callback) => {
1897 options.headers['User-Agent'] = 'JD4iPhone/167169 (iPhone; iOS 13.4.1; Scale/3.00)'
1898 if (options.body) options.headers['Content-Type'] = 'application/x-www-form-urlencoded'
1899 if (isQuanX) {
1900 if (typeof options == "string") options = {
1901 url: options
1902 }
1903 options["method"] = "POST"
1904 //options["opts"] = {
1905 // "hints": false
1906 //}
1907 $task.fetch(options).then(response => {
1908 callback(null, adapterStatus(response), response.body)
1909 }, reason => callback(reason.error, null, null))
1910 }
1911 if (isSurge) {
1912 options.headers['X-Surge-Skip-Scripting'] = false
1913 $httpClient.post(options, (error, response, body) => {
1914 callback(error, adapterStatus(response), body)
1915 })
1916 }
1917 if (isNode) {
1918 node.request.post(options, (error, response, body) => {
1919 callback(error, adapterStatus(response), body)
1920 })
1921 }
1922 if (isJSBox) {
1923 if (typeof options == "string") options = {
1924 url: options
1925 }
1926 options["header"] = options["headers"]
1927 options["handler"] = function(resp) {
1928 let error = resp.error;
1929 if (error) error = JSON.stringify(resp.error)
1930 let body = resp.data;
1931 if (typeof body == "object") body = JSON.stringify(resp.data)
1932 callback(error, adapterStatus(resp.response), body)
1933 }
1934 $http.post(options);
1935 }
1936 }
1937 const AnError = (name, keyname, er, resp, body) => {
1938 if (typeof(merge) != "undefined" && keyname) {
1939 if (!merge[keyname].notify) {

Callers

nothing calls this directly

Calls 3

adapterStatusFunction · 0.70
postMethod · 0.45
stringifyMethod · 0.45

Tested by

no test coverage detected