riskfirst / riskfirst.hateoas

Powerful HATEOAS functionality for .NET web api
MIT License
78 stars 25 forks source link

Add optional scheme arg to AddProtocol #34

Closed JMontagu closed 4 years ago

JMontagu commented 4 years ago

Adds an optional argument to allow the request scheme to be overridden with a static value.

This is useful when you want all links to be https, but your requests aren't (for example, your service is running behind a load balancer with ssl termination).

Currently, to support this requires a custom Add call:

config.ConfigureHrefTransformation(t => t.Add($"{Uri.UriSchemeHttps}://").AddHost().AddRoutePath());

This change allows for:

config.ConfigureHrefTransformation(t => t.AddProtocol(Uri.UriSchemeHttps).AddHost().AddRoutePath());