godprotocol 1.2.11 → 1.2.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/html/index.js CHANGED
@@ -22,18 +22,23 @@ const header_script = (manager)=>{
22
22
  let domain = manager.options.server_domain
23
23
  if (domain.startsWith('127')) domain = `http://${domain}`
24
24
  else domain = `https://${domain}`
25
-
25
+
26
26
  return ` let ftch = async(path, body)=>{
27
- let fch = await fetch("${domain}".concat(path), {
28
- method: 'POST',
29
- header: {
30
- 'Content-Type': 'application/json',
31
- Accept: 'application/json'
32
- },
33
- body: JSON.stringify(body)
34
- })
35
- let response = await fch.json()
36
- return response;
27
+ try{
28
+ let fch = await fetch("${domain}".concat(path), {
29
+ method: 'POST',
30
+ header: {
31
+ 'Content-Type': 'application/json',
32
+ Accept: 'application/json'
33
+ },
34
+ body: JSON.stringify(body)
35
+ })
36
+ let response = await fch.json()
37
+ return response;
38
+ }catch(e){
39
+ console.log(e)
40
+ return {message: e.message}
41
+ }
37
42
  }`
38
43
  }
39
44
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "godprotocol",
3
- "version": "1.2.11",
3
+ "version": "1.2.13",
4
4
  "description": "A distributed computing environment",
5
5
  "main": "Index.js",
6
6
  "scripts": {
package/utils/services.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import http from 'http'
2
+ import https from 'https'
2
3
 
3
4
  const post_request = (payload, cb) => {
4
5
  // let options = {
@@ -29,7 +30,9 @@ const post_request = (payload, cb) => {
29
30
  if(payload.data){
30
31
  header["Content-Length"] = Buffer.byteLength(data)
31
32
  }
32
- let req = http.request(
33
+
34
+ let mod = process.env.VERCEL ? https : http
35
+ let req = mod.request(
33
36
  header,
34
37
  (res) => {
35
38
  let data = "";