2

I'm currently creating both the client and server app using ActiveResource for web servicing. The client has a long string (:history) that needs a conversion process done by the server.

Here, the client calls the post method on my object which extends ActiveResource::Base

active_resource.post(:convert, {:history => hh, :format => format})

This line errors complaining that the URI is too long:

ActiveResource::ClientError Failed. Response code = 414. Response message = Request-URI Too Large.

What other options do I have for sending "large" data ? Probably looking in the neighborhood of 2000 characters of data for the hh string above.

Thanks!

omgwot
  • 89
  • 1
  • 8

2 Answers2

6

So the signature for the post method is:

post(custom_method_name, options = {}, body = '')

So, when you do:

active_resource.post(:convert, {:history => hh, :format => format})

It's putting your post variables in the options hash, which comes out in your query string for the post.

What you want to do is:

active_resource.post(:convert, nil, {:history => hh, :format => format}.to_json)
jeffluckett
  • 142
  • 1
  • 6
0

I didn't think post parameters factored into URI length. Are you sure it's the hh string and not the actual URI that active_resource.post is using?

Ryan Angilly
  • 1,589
  • 16
  • 18