Fx.http

     Fx.http:和http请求相关的API

     其中content属性类型为String/Map,根据HTTP返回头Content-Type中是否包含application/json来决定content类型,True是Map,False是String;

1、HTTP GET请求息-get

     定义:Fx.http.get(<String url>,<Map headers>)

     data返回值类型:HttpResult,属性有:statusCode、content

     例:

def (Boolean error,HttpResult data,String errorMessage) =  Fx.http.get("http://www.fxiaoke.com",["X-token":"myToken"])

2、HTTP POST请求-post

     定义:Fx.http.post(<String url>,<Map headers>,<Map/String data>)

     data返回值类型:HttpResult,属性有:statusCode、content

     例:

def (Boolean error,HttpResult data,String errorMessage) =  Fx.http.post("http://www.fxiaoke.com",["X-token":"myToken"],["id":1])

results matching ""

    No results matching ""