1- import http from " http" ;
2- import https from " https" ;
1+ import http from ' http' ;
2+ import https from ' https' ;
33
4- import Config from " ./config" ;
4+ import Config from ' ./config' ;
55
66function performRequest ( method , url , headers , payload ) {
7- let isTLS = url . protocol === " https:" ;
7+ let isTLS = url . protocol === ' https:' ;
88 let client = isTLS ? https : http ;
99
1010 let options = {
1111 method,
1212 hostname : url . host ,
13- port : url . port !== "" ? url . port : isTLS ? 443 : 80 ,
13+ port : url . port !== '' ? url . port : isTLS ? 443 : 80 ,
1414 path : url . pathname ,
1515 headers : headers ,
1616 } ;
@@ -20,7 +20,7 @@ function performRequest(method, url, headers, payload) {
2020 resolve ( response ) ;
2121 } ) ;
2222
23- request . on ( " error" , ( error ) => {
23+ request . on ( ' error' , ( error ) => {
2424 reject ( error ) ;
2525 } ) ;
2626
@@ -38,28 +38,28 @@ export default class Client {
3838 }
3939
4040 get ( endpoint ) {
41- return this . _request ( " GET" , endpoint ) ;
41+ return this . _request ( ' GET' , endpoint ) ;
4242 }
4343
4444 put ( endpoint , payload ) {
45- return this . _request ( " PUT" , endpoint , payload ) ;
45+ return this . _request ( ' PUT' , endpoint , payload ) ;
4646 }
4747
4848 post ( endpoint , payload ) {
49- return this . _request ( " POST" , endpoint , payload ) ;
49+ return this . _request ( ' POST' , endpoint , payload ) ;
5050 }
5151
5252 delete ( endpoint , payload ) {
53- return this . _request ( " DELETE" , endpoint , payload ) ;
53+ return this . _request ( ' DELETE' , endpoint , payload ) ;
5454 }
5555
5656 _request ( method , endpoint , payload ) {
5757 let { pushEndpoint, pushKey } = this . config ;
5858
5959 let url = new URL ( endpoint , pushEndpoint ) ;
6060 let headers = {
61- Accept : " application/json" ,
62- " Content-Type" : " application/json; charset=UTF-8" ,
61+ Accept : ' application/json' ,
62+ ' Content-Type' : ' application/json; charset=UTF-8' ,
6363 Authorization : `Push ${ pushKey } ` ,
6464 } ;
6565
0 commit comments