Prepending relative urls with '/'
This commit is contained in:
parent
b40578b89b
commit
982ac32fea
|
|
@ -173,6 +173,10 @@ export class HttpConnection implements IConnection {
|
|||
? `${window.document.location.protocol}//${(parser.host || window.document.location.host)}`
|
||||
: `${parser.protocol}//${parser.host}`;
|
||||
|
||||
if (!url || url[0] != '/') {
|
||||
url = '/' + url;
|
||||
}
|
||||
|
||||
let normalizedUrl = baseUrl + url;
|
||||
this.logger.log(LogLevel.Information, `Normalizing '${url}' to '${normalizedUrl}'`);
|
||||
return normalizedUrl;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:60249/",
|
||||
"sslPort": 0
|
||||
}
|
||||
},
|
||||
"profiles": {
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"Microsoft.AspNetCore.SignalR.Test.Server": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
"applicationUrl": "http://localhost:5000/"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -34,7 +34,9 @@ describe('connection', function () {
|
|||
eachTransport(function (transportType) {
|
||||
it("over " + signalR.TransportType[transportType] + " can send and receive messages", function (done) {
|
||||
var message = "Hello World!";
|
||||
var connection = new signalR.HttpConnection(ECHOENDPOINT_URL, {
|
||||
// the url should be resolved relative to the document.location.host
|
||||
// and the leading '/' should be automatically added to the url
|
||||
var connection = new signalR.HttpConnection("echo", {
|
||||
transport: transportType,
|
||||
logging: signalR.LogLevel.Trace
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue