Contain() acting on HTTP response


#1

Hi,

I’m using the ‘make web request’ action to load the Google ICAL feed for UK public holidays, and trying to find the current date in the response. However, although it is currently a public holiday (new year’s day!) the contains() function is failing to find today’s date in the feed, even though I know it’s there. I debugged with a few hypotheses:

  • Maybe it truncates the response? Tried searching for something in the first few lines of the response
  • Maybe it only searches up to the first newline? Tried searching for a character in the first line.

Doesn’t seem to have any effect. I’m wondering now if it’s a type issue, somehow? The response is a 200 with a content-type of text/calendar

Log (trimmed a bit):

|+0ms  |╔Received event [London 19SBR].time = 1514814840000 with a delay of -944ms|
|+135ms|║║Sending external web request to: calendar.google.com/calendar/ical/uk%40holiday.calendar.google.com/public/basic.ics|
|+375ms|║║Executed virtual command httpRequest (241ms)|
|+385ms|║║BEGIN:VCALENDAR|
|+385ms|║║PRODID:-//Google Inc//Google Calendar 70.9054//EN|
|+389ms|║║...[TRUNCATED]|
|+390ms|║║Executed virtual command log (9ms)|
|+395ms|║║Executed virtual command setVariable (3ms)|
|+401ms|║║BEGIN:VCALENDAR|
|+401ms|║║Executed virtual command log (1ms)|
|+409ms|║║Executed virtual command setVariable (2ms)|
|+417ms|║║false|
|+417ms|║║Executed virtual command log (1ms)|
|+423ms|║║false|
|+424ms|║║Executed virtual command log (1ms)|
|+430ms|║║200|
|+431ms|║║Executed virtual command log (1ms)|
|+436ms|║║text/calendar|
|+437ms|║║Executed virtual command log (1ms)|

At this point I’d just reduced it to searching for the character ‘V’ in the response, and it should find it in the first line.


#2

What does the full response look like?

You might be able to trim it down by following

$response.dataField.something.date

And then you can make a comparison on that.


#3

The response is ICAL format, not JSON, how would it become $response.dataField etc?

Are there any docs on this behaviour? I have picked up from various comments in posts that the response is parsed into $json, but is $response also a parsed output if the content type is JSON?

In this case, is isn’t, in any case.


#4

It would help if you showed the full output. I was just taking a stab in the dark with my guess.