Родитель
5f82841356
Коммит
a8fcd12766
|
@ -3241,6 +3241,29 @@ namespace Refit.Tests
|
|||
Assert.Equal("Foo=Something&Bar=100&Baz=", output.SendContent);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void BodyContentGetsUrlEncodedWithCollectionFormat()
|
||||
{
|
||||
var settings = new RefitSettings() { CollectionFormat = CollectionFormat.Csv };
|
||||
var fixture = new RequestBuilderImplementation<IDummyHttpApi>(settings);
|
||||
var factory = fixture.RunRequest("PostSomeUrlEncodedStuff");
|
||||
var output = factory(
|
||||
new object[]
|
||||
{
|
||||
6,
|
||||
new
|
||||
{
|
||||
Foo = "Something",
|
||||
Bar = 100,
|
||||
FooBar = new [] {5,7},
|
||||
Baz = "" // explicitly use blank to preserve value that would be stripped if null
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
Assert.Equal("Foo=Something&Bar=100&FooBar=5%2C7&Baz=", output.SendContent);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void FormFieldGetsAliased()
|
||||
{
|
||||
|
|
|
@ -65,7 +65,8 @@ namespace Refit
|
|||
// see if there's a query attribute
|
||||
var attrib = property.GetCustomAttribute<QueryAttribute>(true);
|
||||
|
||||
if (value is not IEnumerable enumerable)
|
||||
// add strings/non enumerable properties
|
||||
if (value is not IEnumerable enumerable || value is string)
|
||||
{
|
||||
Add(
|
||||
fieldName,
|
||||
|
|
Загрузка…
Ссылка в новой задаче