Hi all,
I tried to create nodes with random names using Sling Post Servlet and
XHR, but I always receive responses with status code 200 and not 201
as expected. Also the Location header is missing in the response. Lars
pointed me to the discussion around this issues in [1]. But I'm
wondering if there is a consensus on how to solve this? In my eyes
parsing a XML files to find out what happened is a "no go", because
this is not standardized in HTTP (which is the interface contract we
are using here) and it is not funny to deal with this in client side
JS. On the other hand normal form posts and XHR requests are likely to
occur more frequently than hidden iframes.
So I would suggest to implement the proposal from Felix, which means
the response always contains the correct response codes and header
fields (like Location) and there will be another request parameter
which allows to override the response code for special case handling
like hidden iframes in forms. This parameter could be named
sling:post:responseCodeOverride and the value could be the response
code that should be used. If the parameter is not present the real
response code will be send.
WDYT?
Regards,
Alex
[1] https://issues.apache.org/jira/browse/SLING-292