dotnet / dotnet/dotnet-api-docs

Clarification on the interaction between BaseAddress and RequestUri needed

Open
#1,044 5 comments 4 reactions 0 assignees View on GitHub
area-System.Net doc-enhancement dotnet-api/prod Pri2
Dominant language
C#
Stars
949
Forks
1.7k
Avg merge
3d 27m
Merged PRs (30d)
49

Description

There needs to be a clarification on how the BaseAddress and HttpRequestMessage's RequestUri are merged. Specifically, BaseAddress must end with a slash ('/') and RequestUri can't:

BaseAddress(BA) = https://server.domain.com/api
RequestUri(RU) = controller/action

Results in "https://server.domain.com/controller/action"

also:

BA = https://server.domain.com/api/
RU = /controller/action

Results in "https://server.domain.com/controller/action" too

and finally:

BA = https://server.domain.com/api/
RU = controller/action

Results in "https://server.domain.com/api/controller/action" which is the expected request

Documentation should explain this behavior and not assume people being familiar with RFC 3986 (https://tools.ietf.org/html/rfc3986)

---
#### Document Details

⚠ *Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.*

* ID: 9294a1a6-2e97-10b4-ddf9-79893a343ee5
* Version Independent ID: de1d10bd-b17f-bad7-9409-87323035ff10
* Content: [HttpClient.BaseAddress Property (System.Net.Http)](https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient.baseaddress?redirectedfrom=MSDN&view=netframework-4.7.2#System_Net_Http_HttpClient_BaseAddress)
* Content Source: [xml/System.Net.Http/HttpClient.xml](https://github.com/dotnet/dotnet-api-docs/blob/master/xml/System.Net.Http/HttpClient.xml)
* Product: **dotnet-api**
* GitHub Login: @karelz
* Microsoft Alias: **ncldev**

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.