Skip to main content
edited tags
Link
rene
  • 2.8k
  • 2
  • 17
  • 35
Source Link

Serel returns a JSON Parse error for the 'C#' tag

When I try requesting the tag c# via Serel, I get an error.

This is the error I am getting:

INFO][2013-02-25 02:06:42] Making request to /2.0/tags/c#/info?site=stackoverflow&key=mykey
JSON::ParserError: 757: unexpected token at '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
<HTML><HEAD><TITLE>Bad Request</TITLE>
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"></HEAD>
<BODY><h2>Bad Request - Invalid URL</h2>
<hr><p>HTTP Error 400. The request URL is invalid.</p>
</BODY></HTML>
'
    from /.rvm/gems/ruby-1.9.3-p194@myapp/gems/json-1.7.7/lib/json/common.rb:155:in `parse'
    from /.rvm/gems/ruby-1.9.3-p194@myapp/gems/json-1.7.7/lib/json/common.rb:155:in `parse'
    from /.rvm/gems/ruby-1.9.3-p194@myapp/gems/serel-1.0.1/lib/serel/request.rb:38:in `make_request'
    from /.rvm/gems/ruby-1.9.3-p194@myapp/gems/serel-1.0.1/lib/serel/request.rb:17:in `execute'
    from /.rvm/gems/ruby-1.9.3-p194@myapp/gems/serel-1.0.1/lib/serel/relation.rb:129:in `request'
    from /.rvm/gems/ruby-1.9.3-p194@myapp/gems/serel-1.0.1/lib/serel/relation.rb:113:in `get'
    from /.rvm/gems/ruby-1.9.3-p194@myapp/gems/serel-1.0.1/lib/serel/tag.rb:17:in `find_by_name'
    from /myapp/lib/tag_fetcher.rb:8:in `find_tag'

This can be replicated by simply doing this:

 > Serel::Tag.find_by_name('c#')
[INFO][2013-02-25 02:26:44] Making request to /2.0/tags/c#/info?site=stackoverflow&key=mykey
JSON::ParserError: 743: unexpected token at '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
<HTML><HEAD><TITLE>Bad Request</TITLE>
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"></HEAD>

There a suitable workaround for this, other than skipping the tag?