DataConnectors icon indicating copy to clipboard operation
DataConnectors copied to clipboard

Getting Response.Status auf Web.Contents request causes another request to be fired

Open fmms opened this issue 3 years ago • 3 comments

Hi,

I have the following Code:

GetData = (Url as text, Token as text) =>
    let 
       Content = Web.Contents(Url,  [Headers=[Authorization="Bearer " & Token], ManualStatusHandling={400, 401, 403, 404, 429, 500, 503}]),
       ResponseCode = Value.Metadata(Content)[Response.Status],
       R = if 200 = 200 then Json.Document(Content) else Json.Document("{payload:[]}"),
       Rbug = if ResponseCode = 200 then Json.Document(Content) else Json.Document("{payload:[]}")
    in
       Rbug;

I expect that this code triggers one HTTP request. However, after spending an evening with Fiddler, I have to realize that two HTTP requests are sent out when returning Rbug and just one when returning R.

Binary.Buffer does not help as then the meta data is lost and Response.Status does not exist anymore.

Is there any workarround for that behaviour? We need to catch error code because they do occur and have to be handled in the connector.

Thanks

fmms avatar Jul 29 '20 20:07 fmms