Skip to content

Escher Put Request #5

@invent360

Description

@invent360

Hi,
was trying to do a PUT request (following the testTheSimplestGetRequest() example in the escher-java/src/test/java/com/emarsys/escher/acceptance/AcceptanceTests.java file).

My Test method looks as follows:

    @Test
    public void testTheSimplestPutRequest() throws Exception {
        HttpRequestBase put = new HttpPut("https://xyz:443/api/api-services/");

        String body = "String test body";

        put = client.signPutRequest(put, body);
        String response = client.sendRequest(put);
    }

i have also modified the signRequest() to now accept a body like so:

    public HttpRequestBase signPutRequest(HttpRequestBase request, String body) throws EscherException {
        EscherRequestClientImpl escherRequest = new EscherRequestClientImpl(request, body);
        escher.signRequest(escherRequest, ESCHER_ACCESS_KEY_ID, ESCHER_SECRET, new ArrayList<>());
        return escherRequest.getHttpRequest();
    }

This returns the following error:

{"message":"HTTP Status 401 - verification failed for axbbc-9459-4798-a6cb-sddff: The signatures do not match (provided: xbxbxbxbx, calculated: fbfbfbf). path: api/api-services","errors":{}}

version: 0.3.1

Any ideas or any example on how to sign a PUT or POST request ?
Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions