taylorfinnell / awscr-signer

AWS request signing in Crystal
MIT License
22 stars 15 forks source link

Crystal 0.30.0 fixes (escape -> encode) #44

Closed jackturnbull closed 4 years ago

jackturnbull commented 4 years ago

I appear to still be getting;

In /usr/local/Cellar/crystal/0.31.0/src/uri/encoding.cr:174:3

 174 | def self.escape(string : String, space_to_plus = false)
       ^-----
Warning: Deprecated URI.escape. Use .encode or .encode_www_form instead

Which I tracked down to be from the changed file in this PR. I believe encode is the right method here, as per crystal-lang/crystal#7997.

Adds methods URI.encode and URI.decode for URL encoding without escaping reserved characters. These are to be used when encoding URLs.

taylorfinnell commented 4 years ago

Thanks! Looks like Timecop needs a fix, I will try to fix it this weekend or remove it

jackturnbull commented 4 years ago

Moved to the crystal-community maintained package, and now using blocks.

It appears that Spec.before_each is a globally scoped call and the load order of files will determine which one is used. Moved to providing a time freeze within a block, and this is recommended by Timecop's safe mode.

I don't love having to wrap each spec in a block largely because of more test scaffolding in every test, honestly, but I don't feel like there's many good alternatives given the Spec.before_each global issue.

edit: also big big well done for having tests for the encoding of restricted characters. I'd have missed that if not, and again for spaces.