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

Allow full URL's, not only hostnames #41

Closed
derwasp opened this issue Jul 24, 2016 · 3 comments
Closed

Allow full URL's, not only hostnames #41

derwasp opened this issue Jul 24, 2016 · 3 comments
Labels

Comments

@derwasp
Copy link

derwasp commented Jul 24, 2016

Description

It is not possible to specify the full URL (e.g. http://my.awesome.api/) as a parameter.
The reason I need this is because I want to be able to specify both http and https endpoints whenever I want to.

Consider the following code:

[<Literal>]
let private awesomeJsonPath = __SOURCE_DIRECTORY__ + "/awesome.swagger.json"
type AwesomeApi = SwaggerProvider<awesomeJsonPath, "Content-Type=application/json">

let private client = new AwesomeApi("http://my.awesome.api/")

printfn "%A" client.AwesomeValueGet(42)

Currently this will crash.

Expected behavior

http/https prefixes are respected and taken into account when the request is constructed

Actual behavior

An unhandled exception of type 'System.Net.WebException' occurred in FSharp.Core.dll
Additional information: The remote name could not be resolved: 'http'

Known workarounds

Use only hostname

@sergey-tihon
Copy link
Member

sergey-tihon commented Jul 25, 2016

You should be able to create two clients for two endpoints

[<Literal>]
let private awesomeJsonPath = __SOURCE_DIRECTORY__ + "/awesome.swagger.json"
type AwesomeApi = SwaggerProvider<awesomeJsonPath, "Content-Type=application/json">

let private clientHttp = AwesomeApi("http://my.awesome.api/")
let private clientHttps = AwesomeApi("https://my.awesome.api/")

printfn "%A" clientHttp.AwesomeValueGet(42)
printfn "%A" clientHttps.AwesomeValueGet(42)

@derwasp
Copy link
Author

derwasp commented Jul 25, 2016

Please take a look at this screenshot:
capture

And that is what happens if Fiddler is launched:
fiddler

SwaggerProvider used: 0.5.3

I guess this is why.

@sergey-tihon
Copy link
Member

Should be fixed in v0.5.5

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

No branches or pull requests

2 participants