Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Escher Put Request #5

Open
invent360 opened this issue Jun 7, 2021 · 0 comments
Open

Escher Put Request #5

invent360 opened this issue Jun 7, 2021 · 0 comments

Comments

@invent360
Copy link

invent360 commented Jun 7, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant