Unknown Mime-type throwing System.Format exception in OR 2.1

5 views
Skip to first unread message

Greg Sochanik

unread,
Nov 29, 2011, 5:54:32 AM11/29/11
to open...@googlegroups.com
Hi,

A while back we fixed an issue in our fork of Openrasta 2.0 that dealt with the following:

  • If a request came in for an unknown content-type using an invalid Accept header (e.g - "Accept: *.*, *" - an actual one we were receiving incidentally!!)
  • Then a System.Format exception was being thrown.

Digging down we found out that this was to do with using .NETs new MediaType(), which in turn tries to parse what's been provided in the accept header.

To fix this, we pulled the method our of the Select loop, and wrapped the new MediaType in a try catch, allowing it to return the default media Type, if an error was caught.


The issue is, we really need this to be fixed in the main 2.1 branch if possible. Can I send a Pull Request to have it pulled into OR 2.1, we want to try and keep our fork as close as possible to the main branch going forwards.

Thanks,
Greg Sochanik

Sebastien Lambla

unread,
Nov 29, 2011, 10:28:40 AM11/29/11
to open...@googlegroups.com
Yes, there's a bunch of pull requests waiting to be pulled in, if you want to add yours that'd be great.


In general I can review and apply pull requests that don't break tests and have tests pretty quickly. If they don't it takes longer as someone has to write the tests before merging and I've not had enough time to spend on doing that lately.

I'm still working in-between two countries till the end of the year, so expect my code contributions to be on the slow side until then, after that things will go back to normal.

I think that'd be a great tagline actually "write the tests, it'll make your pull requests sweeter" :)

Seb

From: open...@googlegroups.com [open...@googlegroups.com] on behalf of Greg Sochanik [gr...@sochanik.com]
Sent: 29 November 2011 10:54
To: open...@googlegroups.com
Subject: [openrasta] Unknown Mime-type throwing System.Format exception in OR 2.1

Greg Sochanik

unread,
Nov 29, 2011, 10:56:59 AM11/29/11
to open...@googlegroups.com
Thanks for that, I'll put it on a t-shirt. :-)

The tests are there already as part of that commit (see OpenRasta.Tests.Unit/Pipeline/Contributors/ResponseEntityCodecResolver_Specification.cs), 
so I'll just set up the request and we're good to go. 

Greg
--
Greg Sochanik  
66a Cloudesley Road
London
N1 0EB
07968062483

Greg Sochanik

unread,
Dec 1, 2011, 4:28:06 PM12/1/11
to open...@googlegroups.com
Just to let you know, I noticed the pull requests already there.


Graham did it back in June, my commits are at the bottom.

Cheers,
Greg


Sent: 29 November 2011 15:56
To: open...@googlegroups.com
Subject: Re: [openrasta] Unknown Mime-type throwing System.Format exception in OR 2.1

Reply all
Reply to author
Forward
0 new messages