Examples of sendRawPost()


Examples of org.apache.shindig.gadgets.oauth.testing.MakeRequestClient.sendRawPost()

  @Test
  public void testPostBinaryData() throws Exception {
    byte[] raw = { 0, 1, 2, 3, 4, 5 };
    MakeRequestClient client = makeSignedFetchClient("o", "v", "http://www.example.com/app");
    HttpResponse resp = client.sendRawPost(FakeOAuthServiceProvider.RESOURCE_URL, null, raw);
    List<Parameter> queryParams = OAuth.decodeForm(resp.getResponseAsString());
    assertTrue(contains(queryParams, "opensocial_owner_id", "o"));
    assertTrue(contains(queryParams, OAuth.OAUTH_CONSUMER_KEY, "signedfetch"));
    String echoed = resp.getHeader(FakeOAuthServiceProvider.RAW_BODY_ECHO_HEADER);
    byte[] echoedBytes = Base64.decodeBase64(CharsetUtil.getUtf8Bytes(echoed));
View Full Code Here

Examples of org.apache.shindig.gadgets.oauth.testing.MakeRequestClient.sendRawPost()

  @Test
  public void testPostWeirdContentType() throws Exception {
    byte[] raw = { 0, 1, 2, 3, 4, 5 };
    MakeRequestClient client = makeSignedFetchClient("o", "v", "http://www.example.com/app");
    HttpResponse resp = client.sendRawPost(FakeOAuthServiceProvider.RESOURCE_URL,
        "funky-content", raw);
    List<Parameter> queryParams = OAuth.decodeForm(resp.getResponseAsString());
    assertTrue(contains(queryParams, "opensocial_owner_id", "o"));
    assertTrue(contains(queryParams, OAuth.OAUTH_CONSUMER_KEY, "signedfetch"));
    String echoed = resp.getHeader(FakeOAuthServiceProvider.RAW_BODY_ECHO_HEADER);
View Full Code Here

Examples of org.apache.shindig.gadgets.oauth.testing.MakeRequestClient.sendRawPost()

      public HttpResponse fetch(HttpRequest request) throws GadgetException {
        request.setPostBody("yo momma".getBytes());
        return serviceProvider.fetch(request);
      }
    });
    client.sendRawPost(FakeOAuthServiceProvider.RESOURCE_URL,
       "funky-content", raw);
    fail("Should have thrown with oauth_body_hash mismatch");
  }

  @Test(expected=RuntimeException.class)
View Full Code Here

Examples of org.apache.shindig.gadgets.oauth.testing.MakeRequestClient.sendRawPost()

        request.setPostBody(ArrayUtils.EMPTY_BYTE_ARRAY);
        request.setHeader("Content-Type", "application/x-www-form-urlencoded");
        return serviceProvider.fetch(request);
      }
    });
    client.sendRawPost(FakeOAuthServiceProvider.RESOURCE_URL,
        "funky-content", raw);
    fail("Should have thrown with body hash in form encoded request");
  }

  @Test
View Full Code Here

Examples of org.apache.shindig.gadgets.oauth.testing.MakeRequestClient.sendRawPost()

 
  @Test
  public void testPostBinaryData() throws Exception {
    byte[] raw = { 0, 1, 2, 3, 4, 5 };
    MakeRequestClient client = makeSignedFetchClient("o", "v", "http://www.example.com/app");
    HttpResponse resp = client.sendRawPost(FakeOAuthServiceProvider.RESOURCE_URL, null, raw);
    List<Parameter> queryParams = OAuth.decodeForm(resp.getResponseAsString());
    assertTrue(contains(queryParams, "opensocial_owner_id", "o"));
    assertTrue(contains(queryParams, OAuth.OAUTH_CONSUMER_KEY, "signedfetch"));
    String echoed = resp.getHeader(FakeOAuthServiceProvider.RAW_BODY_ECHO_HEADER);
    byte[] echoedBytes = Base64.decodeBase64(CharsetUtil.getUtf8Bytes(echoed));
View Full Code Here

Examples of org.apache.shindig.gadgets.oauth.testing.MakeRequestClient.sendRawPost()

  @Test
  public void testPostWeirdContentType() throws Exception {
    byte[] raw = { 0, 1, 2, 3, 4, 5 };
    MakeRequestClient client = makeSignedFetchClient("o", "v", "http://www.example.com/app");
    HttpResponse resp = client.sendRawPost(FakeOAuthServiceProvider.RESOURCE_URL,
        "funky-content", raw);
    List<Parameter> queryParams = OAuth.decodeForm(resp.getResponseAsString());
    assertTrue(contains(queryParams, "opensocial_owner_id", "o"));
    assertTrue(contains(queryParams, OAuth.OAUTH_CONSUMER_KEY, "signedfetch"));
    String echoed = resp.getHeader(FakeOAuthServiceProvider.RAW_BODY_ECHO_HEADER);
View Full Code Here

Examples of org.apache.shindig.gadgets.oauth.testing.MakeRequestClient.sendRawPost()

        request.setPostBody("yo momma".getBytes());
        return serviceProvider.fetch(request);
      }
    });
    try {
      client.sendRawPost(FakeOAuthServiceProvider.RESOURCE_URL,
          "funky-content", raw);
      fail("Should have thrown with oauth_body_hash mismatch");
    } catch (RuntimeException e) {
      // good
    }
View Full Code Here

Examples of org.apache.shindig.gadgets.oauth.testing.MakeRequestClient.sendRawPost()

        request.setHeader("Content-Type", "application/x-www-form-urlencoded");
        return serviceProvider.fetch(request);
      }
    });
    try {
      client.sendRawPost(FakeOAuthServiceProvider.RESOURCE_URL,
          "funky-content", raw);
      fail("Should have thrown with body hash in form encoded request");
    } catch (RuntimeException e) {
      // good
    }
View Full Code Here

Examples of org.apache.shindig.gadgets.oauth.testing.MakeRequestClient.sendRawPost()

 
  @Test
  public void testPostBinaryData() throws Exception {
    byte[] raw = { 0, 1, 2, 3, 4, 5 };
    MakeRequestClient client = makeSignedFetchClient("o", "v", "http://www.example.com/app");
    HttpResponse resp = client.sendRawPost(FakeOAuthServiceProvider.RESOURCE_URL, null, raw);
    List<Parameter> queryParams = OAuth.decodeForm(resp.getResponseAsString());
    assertTrue(contains(queryParams, "opensocial_owner_id", "o"));
    assertTrue(contains(queryParams, OAuth.OAUTH_CONSUMER_KEY, "signedfetch"));
    String echoed = resp.getHeader(FakeOAuthServiceProvider.RAW_BODY_ECHO_HEADER);
    byte[] echoedBytes = Base64.decodeBase64(CharsetUtil.getUtf8Bytes(echoed));
View Full Code Here

Examples of org.apache.shindig.gadgets.oauth.testing.MakeRequestClient.sendRawPost()

  @Test
  public void testPostWeirdContentType() throws Exception {
    byte[] raw = { 0, 1, 2, 3, 4, 5 };
    MakeRequestClient client = makeSignedFetchClient("o", "v", "http://www.example.com/app");
    HttpResponse resp = client.sendRawPost(FakeOAuthServiceProvider.RESOURCE_URL,
        "funky-content", raw);
    List<Parameter> queryParams = OAuth.decodeForm(resp.getResponseAsString());
    assertTrue(contains(queryParams, "opensocial_owner_id", "o"));
    assertTrue(contains(queryParams, OAuth.OAUTH_CONSUMER_KEY, "signedfetch"));
    String echoed = resp.getHeader(FakeOAuthServiceProvider.RAW_BODY_ECHO_HEADER);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.