File tree Expand file tree Collapse file tree 4 files changed +13
-10
lines changed
Expand file tree Collapse file tree 4 files changed +13
-10
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,6 @@ let options: Options = {
66 user : 'root' ,
77 passwd : 'taosdata' ,
88 host : "127.0.0.1" ,
9- port : 6041 ,
109}
1110let connect = function connect ( option : Options ) {
1211 // console.log("index.options:"+JSON.stringify(option));
Original file line number Diff line number Diff line change 11{
22 "name" : " @tdengine/rest" ,
3- "version" : " 3.0.0 " ,
3+ "version" : " 3.0.1 " ,
44 "description" : " A REST connector for TDengine" ,
55 "source" : " index.ts" ,
66 "main" : " dist/main/index.js" ,
Original file line number Diff line number Diff line change @@ -43,15 +43,15 @@ export class TDengineCursor {
4343 return new Result ( res_json ) ;
4444 }
4545
46- } else if ( response . status == 400 ) {
47- new Error ( "invalid parameters." )
48- } else if ( response . status == 401 ) {
46+ } else if ( response . status == 400 ) {
47+ new Error ( "invalid parameters." )
48+ } else if ( response . status == 401 ) {
4949 throw new Error ( "Authentication failed." )
50- } else if ( response . status == 404 ) {
50+ } else if ( response . status == 404 ) {
5151 throw new Error ( "interface not exists." )
52- } else if ( response . status == 500 ) {
52+ } else if ( response . status == 500 ) {
5353 throw new Error ( "internal error." )
54- } else if ( response . status == 503 ) {
54+ } else if ( response . status == 503 ) {
5555 throw new Error ( "insufficient system resource." )
5656 }
5757 throw new Error ( "http request failed." ) ;
Original file line number Diff line number Diff line change @@ -36,8 +36,11 @@ export class TDResRequest {
3636 } else {
3737 //do nothing
3838 }
39- url = `${ this . uri . scheme } ://${ this . uri . host } :${ this . uri . port } ${ this . uri . path } `
40-
39+ if ( this . uri . port ) {
40+ url = `${ this . uri . scheme } ://${ this . uri . host } :${ this . uri . port } ${ this . uri . path } `
41+ } else {
42+ url = `${ this . uri . scheme } ://${ this . uri . host } ${ this . uri . path } `
43+ }
4144 if ( this . uri . query ) {
4245 url += '?'
4346 Object . keys ( this . uri . query ) . forEach (
@@ -103,6 +106,7 @@ export class TDResRequest {
103106
104107 request ( command : string ) : Promise < any > {
105108 this . _body ( command ) ;
109+ //console.log(this._makeUrl());
106110 return fetch ( this . _makeUrl ( ) , this . options ) ;
107111 }
108112}
You can’t perform that action at this time.
0 commit comments