Questions tagged [web-api-contrib]

WebAPIContrib is a collection of open source projects to help improve your work with ASP.NET Web API. The projects are divided into a few different categories.

11 questions
17
votes
3 answers

No Response Header in DelegatingHandler

I'm trying to log the HTTP Response Headers of my Web API project. The project is developed by VS2012, .NET 4.5 and ASP.NET MVC 4. I've wrote a DelegatingHandler subclass like this: public class LoggingHandler : DelegatingHandler { protected…
Zhao Xiang
  • 1,625
  • 2
  • 23
  • 40
8
votes
1 answer

Handling invalid JSONP requests in Web API

I am using WebApiContrib.Formatting.Jsonp within a Web API 2 service, plus Swagger for API documentation and testing. When I trigger any JSONP method through Swagger, my service crashes in file JsonpMediaTypeFormatter.cs on the following line: throw…
vitaly-t
  • 24,279
  • 15
  • 116
  • 138
2
votes
1 answer

Usage content-type with webapicontrib.formatting.xlsx

I'm using webapi2 and webapicontrib.formatting.xlsx to create Excel files. If i add this line in the webapiconfig.cs it works ok config.Formatters.Clear(); But then I loose the possibility of default content negotiation, i mean, if request…
polonskyg
  • 4,269
  • 9
  • 41
  • 93
1
vote
1 answer

Using WebApiContrib.Core.Formatter.Csv in ASP.NET Core 3.0 Web API project

I want to migrate the AddCsvSerializerFormatters configuration to .NET Core 3.0 Taken from the example code here services.AddMvc(o => { ... }) .AddCsvSerializerFormatters() A .NET Core 3.0 web api project registers just the…
Bernard Vander Beken
  • 4,848
  • 5
  • 54
  • 76
1
vote
0 answers

ArgumentOutOfRangeException when deserializing protobuf-net request

After deploying a new version of one of our applications we started seeing multiple ArgumentOutOfRangeExceptions from WebApiContrib/protobuf-net. It had happened once before, but occured more frequently (5-10 times or so) after the deploy. It only…
perkrihe
  • 93
  • 5
1
vote
2 answers

WebApiContrib Jsonp and Attribute Routing

Per the WebApiContrib.Formatting.Jsonp GitHub readme, it appears that in the RouteConfig.cs this should be entered: routes.MapHttpRoute( name: "DefaultApi", routeTemplate: "api/{controller}/{id}/{format}", defaults: new { id =…
Robert
  • 1,745
  • 5
  • 34
  • 61
1
vote
1 answer

How to bind MVC API parameters in a JSONP Get?

I created a VS 2012 MVC API project from scratch, loaded the Nuget "WebApiContrib.Formatting.Jsonp", added a route, the formatter, and tried to send parameters as serialized JSON as a JSONP request. How do I identify or access these parameters in…
Zachary Scott
  • 20,968
  • 35
  • 123
  • 205
0
votes
0 answers

How can I convert IEnumerable to Byte64 for file download

I'm using WebApiContrib.Formatting.xlsx to create and download a Microsoft Excel file. My problem is that when called from the client the file can't be opened and several method were tried. When dealing with PDF the problem was resolved converting…
polonskyg
  • 4,269
  • 9
  • 41
  • 93
0
votes
0 answers

How to selectively enable JSONP on WebAPI actions?

I'm using ASP.NET Web API v2.0 to build an web api. I need to make some of the controllers/actions available in CORS/JSONP, so I chose to use WebApiContrib.Formatting.Jsonp. Because I'm not use Web API v2.1 yet, I can only use WebApiContrib…
0
votes
2 answers

Testing ASP.NET Web API POST and Parameterless GET Routes with WebApiContrib.Testing

I am trying to set up some route tests using the WebApiContrib.Testing library. My get tests (like this) work fine... [Test] [Category("Auth Api Tests")] public void TheAuthControllerAcceptsASingleItemGetRouteWithAHashString() { …
0
votes
1 answer

Route testing with WebApiContrib

I have a WebApi project that I am trying to test. I have a controller - public class UserController : ApiController { public string Get() { return "foo"; } } I need to test the route and I am trying to use WebApiContrib.Testing…