Allow to specify content in the PUT METHOD
------------------------------------------

         Key: WT-579
         URL: http://webtest-community.canoo.com/jira/browse/WT-579
     Project: WebTest
        Type: New Feature

    Versions: Future work    
    Reporter: Sergio Pino
 Attachments: InvokePage.java

When using the method PUT we cannot use a XML in the body, or another kind of 
content type.

I think you only need to change the InvokePage:
        @Override
        protected Page findTarget() throws IOException, SAXException {
                if ("POST".equals(getMethod())) {
                        return findTargetByPost();
                }
                if ("PUT".equals(getMethod())) {
                        return findTargetByPut();
                }
                fCompleteUrl = getContext().getConfig().getUrlForPage(getUrl());
                final WebRequest settings = new WebRequest(new 
URL(fCompleteUrl));
                
settings.setHttpMethod(HttpMethod.valueOf(getMethod().toUpperCase()));
                return getResponse(settings);
        }

and since we can have a REST POST:
I suggest as well:

if (!StringUtils.isEmpty(fSoapAction)) {
                        headers.put("Content-type", "text/xml; charset=" + 
charset);
                        headers.put("SOAPAction", fSoapAction);
                } else if (isRest()) {
                        headers.put("Content-type", "application/xml; charset=" 
+ charset);
                } else {
                        // TODO: is this the correct Content-type for non-SOAP 
posts?
                        headers.put("Content-type", 
"application/x-www-form-urlencoded");

}


Then something like this it will work:
<invoke description="Call a put method using rest" rest="true" 
url="/application/test/put" contentFile="myfile.xml" method="PUT" />

With kind regards
Sergio

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://webtest-community.canoo.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

_______________________________________________
WebTest mailing list
WebTest@lists.canoo.com
http://lists.canoo.com/mailman/listinfo/webtest

Reply via email to