Mercurial > prosody-hg
comparison spec/util_http_spec.lua @ 9785:ff88b03c343f
util.http: Fix decoding of uppercase URL encoded chars
Broken in 1af5106a2c34
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Wed, 16 Jan 2019 13:53:04 +0100 |
| parents | 5203b6fd34d4 |
| children | d2e4584ba7b3 |
comparison
equal
deleted
inserted
replaced
| 9784:7fa273f8869e | 9785:ff88b03c343f |
|---|---|
| 26 end); | 26 end); |
| 27 | 27 |
| 28 it("should decode important URL characters", function() | 28 it("should decode important URL characters", function() |
| 29 assert.are.equal("This & that = something", http.urldecode("This%20%26%20that%20%3d%20something"), "Important URL chars escaped"); | 29 assert.are.equal("This & that = something", http.urldecode("This%20%26%20that%20%3d%20something"), "Important URL chars escaped"); |
| 30 end); | 30 end); |
| 31 | |
| 32 it("should decode both lower and uppercase", function () | |
| 33 assert.are.equal("This & that = {something}.", http.urldecode("This%20%26%20that%20%3D%20%7Bsomething%7D%2E"), "Important URL chars escaped"); | |
| 34 end); | |
| 35 | |
| 31 end); | 36 end); |
| 32 | 37 |
| 33 describe("#formencode()", function() | 38 describe("#formencode()", function() |
| 34 it("should encode basic data", function() | 39 it("should encode basic data", function() |
| 35 assert.are.equal(http.formencode({ { name = "one", value = "1"}, { name = "two", value = "2" } }), "one=1&two=2", "Form encoded"); | 40 assert.are.equal(http.formencode({ { name = "one", value = "1"}, { name = "two", value = "2" } }), "one=1&two=2", "Form encoded"); |
