[webtest][JIRA] Created: (WT-579) Allow to specify content in the PUT METHOD

"Sergio Pino (JIRA)" <[email protected]>
Newsgroups gmane.comp.web.canoo.webtest
Message-ID <4395451.1350404502334.JavaMail.nobody@dell1>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.