Skip to content

[Bug]: refit 9.* malformed URL #2032

@mansellan

Description

@mansellan

Describe the bug 🐞

Not sure if I'm doing something wrong, but this used to work prior to v9, but now fails to include the final )

Step to reproduce

using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Refit;

var builder = Host.CreateApplicationBuilder();
builder.Services.AddRefitClient<IAccount>().ConfigureHttpClient(x => x.BaseAddress = new Uri("https://localhost"));
builder.Services.AddHostedService<AccountService>();

builder.Build().Run();

public class AccountService(IAccount account) : BackgroundService
{
    protected override async Task ExecuteAsync(CancellationToken stoppingToken)
    {
        await account.GetAccount(1, stoppingToken);
    }
}

public interface IAccount
{
    [Get("/account({id})")]
    Task GetAccount(int id, CancellationToken cancellationToken = default);
}

Reproduction repository

https://github.com/reactiveui/refit

Expected behavior

Console window should log:

Sending HTTP request GET https://localhost/account(1)

but I get:

Sending HTTP request GET https://localhost/account(1

In an actual request, it just times out.

Screenshots 🖼️

No response

IDE

No response

Operating system

No response

Version

No response

Device

No response

Refit Version

No response

Additional information ℹ️

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions