sahaya / rest-assured

Automatically exported from code.google.com/p/rest-assured
0 stars 0 forks source link

RequestSpecification Issue #216

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Configure a RequestSpecification via a RequestSpecBuilder
2. Initialize RestAssured.baseURI, RestAssured.basePath and RestAssured.port
3. Set the current RequestSpecification via RestAssured.requestSpecification = 
newRequestSpec;

What is the expected output? What do you see instead?
I would expect the current RestAssured configuration to contain the configured 
parameters baseURI, basePath and Port as well as the configured 
RequestSpecification.

When firing the request though, the baseURI, basePath and port default to the 
standard values "http://localhost" and so forth, ignoring the aforementioned 
parameter specification

What version of the product are you using? On what operating system?
RestAssured 1.7.2

Please provide any additional information below.
Here is how I did set up the requestSpecification:
RequestSpecification currentRequestSpecification = new RequestSpecBuilder()
            .addHeader("Accept", ContentType.JSON.toString())
            .addHeader("Content-Type", ContentType.JSON.toString())
            .addFilter(ErrorLoggingFilter.errorLogger())
            .build();

For the sake of completeness here the configuration which is also supplied 
before firing the request:
        currentRestAssuredConfig = new RestAssuredConfig().
            decoderConfig(
                new DecoderConfig("UTF-8")
            ).encoderConfig(
                new EncoderConfig("UTF-8", "UTF-8")
            ));

Before actually firing the the request the following method is invoked to 
prepare the configuration:

    @Before
    public void initialize() {
        RestAssured.reset();
        RestAssured.requestSpecification = currentRequestSpecification;
        RestAssured.config = currentRestAssuredConfig;

        RestAssured.baseURI = "http://myCustomURI";
        RestAssured.port = 1234;
        RestAssured.basePath = "/myCustomBasePath";
    }

Original issue reported on code.google.com by roth.ben...@gmail.com on 6 Feb 2013 at 6:13

GoogleCodeExporter commented 9 years ago
It seems that either the RequestSpecBuilder or the RequestSpecification is 
somehow being initialized with the RestAssured.baseURI, basePath and port 
values which were present at the time of creation of the RequestSpecBuilder or 
the RequestSpecification. Is this a desired behaviour?

Original comment by roth.ben...@gmail.com on 6 Feb 2013 at 7:30

GoogleCodeExporter commented 9 years ago
Hmm could it be that you initialize the RequestSpecification _before_ you 
configure the static configuration?

Original comment by johan.ha...@gmail.com on 6 Feb 2013 at 7:22

GoogleCodeExporter commented 9 years ago
If you still have problems with this then reopen the issue

Original comment by johan.ha...@gmail.com on 4 Jun 2014 at 11:51