mko
mko

Reputation: 7325

WebApi 5.2.7 causing error when passing array as parameter

After I updated Nuget package Microsoft.AspNet.WebApi from 5.2.3 to 5.2.7 I noticed this strange error

The request contains an entity body but no Content-Type header. The inferred media type 'application/octet-stream' is not supported for this resource

Here is my controller action

        [HttpGet]
        [Route("show_many")]
        [ArrayInput("ids", Separator = ',')]
        public async Task<HttpResponseMessage> ShowMany(int[] ids)
        {

//code
            return Request.CreateResponse(HttpStatusCode.OK);
        }

I tried to remove ArrayInput attribute, but it appears that WebApi has problems understanding an array of ints.

Is this a know issue? How do I resolve it?

Upvotes: 0

Views: 176

Answers (1)

mko
mko

Reputation: 7325

Adding [FromUri] to

public async Task<HttpResponseMessage> ShowMany([FromUri] int[] ids)

solved the problem

Upvotes: 0

Related Questions