Package com.google.code.http4j.impl

Examples of com.google.code.http4j.impl.Post


*/
public final class PostTestCase extends RequestTestCase {
 
  @Test(expectedExceptions = MalformedURLException.class)
  public void construct_cause_exception() throws MalformedURLException, URISyntaxException {
    new Post("code.google.com");
  }
View Full Code Here


    assertion("http://localhost:8080/index.jsp;jsessionid=ABCDE?u=colin&pwd=http4j","POST /index.jsp;jsessionid=ABCDE HTTP/1.1\r\nHost:localhost:8080\r\n" + getDefaultHeaderString() + "Content-Length:18\r\n\r\nu=colin&pwd=http4j");
  }
 
  @Test(dependsOnMethods = "toMessage")
  public void addParameter_string_strings() throws URISyntaxException, IOException {
    Post post = new Post("http://www.google.com/search");
    post.addParameter("q", "http4j");
    assertion(post, "POST /search HTTP/1.1\r\nHost:www.google.com\r\n" + getDefaultHeaderString() + "Content-Length:8\r\n\r\nq=http4j");
    post.addParameter("m", "GET", "POST");
    assertion(post, "POST /search HTTP/1.1\r\nHost:www.google.com\r\n" + getDefaultHeaderString() + "Content-Length:21\r\n\r\nq=http4j&m=GET&m=POST");
  }
View Full Code Here

    assertion(post, "POST /search HTTP/1.1\r\nHost:www.google.com\r\n" + getDefaultHeaderString() + "Content-Length:21\r\n\r\nq=http4j&m=GET&m=POST");
  }

  @Test(dependsOnMethods = "toMessage")
  public void setHeader() throws URISyntaxException, IOException {
    Post post = new Post("http://www.google.com/?u=http4j&p=http4j");
    post.setHeader(Headers.ACCEPT_CHARSET, "ISO-8859-1");
    assertion(post, "POST / HTTP/1.1\r\nHost:www.google.com\r\n" + getDefaultHeaderString() + "Accept-Charset:ISO-8859-1\r\nContent-Length:17\r\n\r\nu=http4j&p=http4j");
    post.setHeader(Headers.ACCEPT_CHARSET, "UTF-8");
    assertion(post, "POST / HTTP/1.1\r\nHost:www.google.com\r\n" + getDefaultHeaderString() + "Accept-Charset:UTF-8\r\nContent-Length:17\r\n\r\nu=http4j&p=http4j");
  }
View Full Code Here

    assertion(post, "POST / HTTP/1.1\r\nHost:www.google.com\r\n" + getDefaultHeaderString() + "Accept-Charset:UTF-8\r\nContent-Length:17\r\n\r\nu=http4j&p=http4j");
  }
 
  @Override
  protected Request createRequest(String url) throws MalformedURLException, URISyntaxException {
    return new Post(url);
  }
View Full Code Here

TOP

Related Classes of com.google.code.http4j.impl.Post

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.