alex-sherwin / missing-link

Simple ant http plugin
0 stars 1 forks source link

Add support for storing the result code and output in properties #21

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
It would be nice to be able to store the result code (e.g. 200, 404) in a 
property so that it can be used for controlling the subsequent flow in the Ant 
script.

The same goes for the output from a request, e.g. GET.

I have implemented this in a local copy but as I have incorporated in the patch 
in issue 13, a patch would not be that short and sweet. Anyway, it is trivial 
to implement this.

Original issue reported on code.google.com by anders.j...@gmail.com on 16 Aug 2011 at 11:20

GoogleCodeExporter commented 8 years ago

Original comment by alex.she...@gmail.com on 18 Aug 2011 at 12:55

GoogleCodeExporter commented 8 years ago

Original comment by alex.she...@gmail.com on 18 Aug 2011 at 12:55

GoogleCodeExporter commented 8 years ago
Added an attribute to the root http task "statusProperty" which defines a 
property to save the response status to.  For example:

  <target name="get">
    <http url="http://www.google.com/asfaf" statusProperty="out.status" failOnUnexpected="false"/>
    <echo message="Response Status: ${out.status}"/>
  </target>

Will be available in the 1.1.3 release

Original comment by alex.she...@gmail.com on 18 Aug 2011 at 1:11

GoogleCodeExporter commented 8 years ago
Great!

Would it be possible to add outputProperty as well?

Original comment by anders.j...@gmail.com on 18 Aug 2011 at 1:16

GoogleCodeExporter commented 8 years ago
Whoops,  missed that part.. need to redact 1.1.3 that I'm in the middle of 
releasing

Original comment by alex.she...@gmail.com on 18 Aug 2011 at 2:44

GoogleCodeExporter commented 8 years ago
Added an attribute to the root http task "entityProperty" which defines a 
property to save the response entity to.  For example:

  <target name="http-get">
    <http url="http://www.google.com" entityProperty="ent"/>
    <echo message="resp: ${ent}"/>
  </target>

Original comment by alex.she...@gmail.com on 18 Aug 2011 at 2:54

GoogleCodeExporter commented 8 years ago
Great!

Would it be possible to add headerProperty as well?  That way, one could save 
the entire set of headers, from which one could extract values.

Our specific use case is to save the cookie value returned an initial response, 
to be used in subsequent requests.

Original comment by aronrobe...@gmail.com on 18 Aug 2011 at 6:48

GoogleCodeExporter commented 8 years ago
I can, but i already did 1.1.3 this morning.. If you like, open up a new 
enhancement issue and i'll do a quick 1.1.4 release

Original comment by alex.she...@gmail.com on 18 Aug 2011 at 9:09

GoogleCodeExporter commented 8 years ago
What would you expect this to look like? I wouldn't want to dump all headers 
into a string, then formatting etc would have to be assumed

maybe something like

<http ...>
  <saveHeader name="Cookie-X" property="my.prop"/>
</http>

Original comment by alex.she...@gmail.com on 18 Aug 2011 at 9:11

GoogleCodeExporter commented 8 years ago
Thanks, Alex!

Being able to save the value of any specific header to a property would be 
terrific - far better than having to parse a monolithic string containing all 
of the headers and their values.

How do you suggest handling values of headers, like Set-Cookie, that can appear 
more than once in a response?

(Thanks as well, Anders, for your contributions - much appreciated!)

Original comment by aronrobe...@gmail.com on 19 Aug 2011 at 5:48

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
See Issue 24 for a continuation of the discussion for saving header values

Original comment by alex.she...@gmail.com on 19 Aug 2011 at 12:31

GoogleCodeExporter commented 8 years ago

Original comment by alex.she...@gmail.com on 19 Aug 2011 at 12:51