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

How can I set dynamic values in Header #47

Open
amolchaudhari69 opened this issue Jul 11, 2013 · 2 comments
Open

How can I set dynamic values in Header #47

amolchaudhari69 opened this issue Jul 11, 2013 · 2 comments

Comments

@amolchaudhari69
Copy link

I am trying to write Integration test case using restuse, and able to run test cases finely .
but got stuck when trying to set dynamic value in request header

@httptest( method = Method.GET, path = "/somepath",headers = { @Header(name = "authorization", value = "testheader_6")} )

here header accepts only constant value where as I want to set it dynamically ,because value for authorization is generating randomly.

may I know how can I set value to it dynamically.

Thanks in Advance !!!

@andreasmihm
Copy link

Hi,

in your test you can overriude the method

protected Destination getDestination()
    final Destination destination = new Destination(this, "http://localhost:8080");
    final RequestContext context = destination.getRequestContext();
    context.addHeader("SomeHeader", "SomeValue");
    return destination;
}

this will help you to set dynamic headers.
However, as I have metioned in earlier forum posts, the annotaion based testing approach of restfuse leads to thioses issues, like yours.

The solution would be a alternate way in restfuse for doing rest-tests without using annotations,

regards
Andreas

@amolchaudhari69
Copy link
Author

Hey Thats great...

Thanks A Lot Andreas 👍

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

2 participants