Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save chrisfinne/364074 to your computer and use it in GitHub Desktop.

Select an option

Save chrisfinne/364074 to your computer and use it in GitHub Desktop.

Revisions

  1. chrisfinne created this gist Apr 12, 2010.
    25 changes: 25 additions & 0 deletions tests for simple_record bug of http post of utf-8
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,25 @@
    def test_ascii_http_post
    first_name = "joe" + ("X" * 1000) # pad the field to help get the URL over the 2000 length limit so AWS uses a POST
    last_name = "blow" + ("X" * 1000) # pad the field to help get the URL over the 2000 length limit so AWS uses a POST
    mm = MyModel.create :first_name=>first_name, :last_name=>last_name
    mm.save
    sleep 1
    assert mm.first_name == first_name
    assert mm.last_name == last_name
    mm2 = MyModel.find(mm.id)
    assert mm2.first_name == first_name
    assert mm2.last_name == last_name
    end

    def test_utf8_http_post
    first_name = "josé" + ("X" * 1000) # pad the field to help get the URL over the 2000 length limit so AWS uses a POST
    last_name = "本語" + ("X" * 1000) # pad the field to help get the URL over the 2000 length limit so AWS uses a POST
    mm = MyModel.create :first_name=>first_name, :last_name=>last_name
    mm.save
    sleep 1
    assert mm.first_name == first_name
    assert mm.last_name == last_name
    mm2 = MyModel.find(mm.id)
    assert mm2.first_name == first_name
    assert mm2.last_name == last_name
    end