nidi3 / raml-tester

Test if a request/response matches a given raml definition
Apache License 2.0
71 stars 14 forks source link

RamlLoaders.loadFromUri() throws a guru.nidi.ramltester.loader.RamlLoader$ResourceNotFoundException #13

Closed mbykovskyy closed 10 years ago

mbykovskyy commented 10 years ago

Specifying a URI http://localhost:8080/reader/raml/api_v1.raml fails to read the RAML file and throws an exception.

guru.nidi.ramltester.loader.RamlLoader$ResourceNotFoundException: org.apache.http.client.ClientProtocolException: URI does not specify a valid host name: localhost:8080/reader/raml/api_v1.raml
    at org.apache.http.impl.client.CloseableHttpClient.determineTarget(CloseableHttpClient.java:94)
    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:106)
    at guru.nidi.ramltester.loader.SimpleUrlFetcher.fetchFromUrl(SimpleUrlFetcher.java:33)
    at guru.nidi.ramltester.loader.UrlRamlLoader.fetchResource(UrlRamlLoader.java:51)
    at guru.nidi.ramltester.loader.RamlLoaderRamlParserResourceLoader.fetchResource(RamlLoaderRamlParserResourceLoader.java:34)
    at org.raml.parser.visitor.YamlDocumentBuilder.build(YamlDocumentBuilder.java:76)
    at guru.nidi.ramltester.RamlLoaders.load(RamlLoaders.java:168)
    at guru.nidi.ramltester.RamlLoaders.loadFromUri(RamlLoaders.java:92)

After digging through the code it looks like the http:// part is stripped off which may be the cause of this issue. Specifying http:// twice like so http://http://localhost:8080/reader/raml/api_v1.raml by-passes the issue but causes another issue which I'm going to log separately.

I'm using 0.0.6 version.

nidi3 commented 10 years ago

There's a test case for this. Unfortunately, it's @Ignore'd :( Going to fix it.

mbykovskyy commented 10 years ago

@ddossot