Project

General

Profile

Feature #14316

Update Status Code classes

Added by znz (Kazuhiro NISHIYAMA) 17 days ago. Updated 11 days ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
[ruby-core:84645]

Description

In lib/net/http/responses.rb, some class names are old names.
So I would like to update and add 103 Early Hints if no objection.

see https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml

0001-Specify-frozen_string_literal-true.patch (697 Bytes) 0001-Specify-frozen_string_literal-true.patch znz (Kazuhiro NISHIYAMA), 01/05/2018 01:51 PM
0002-Add-103-Early-Hints.patch (1.11 KB) 0002-Add-103-Early-Hints.patch znz (Kazuhiro NISHIYAMA), 01/05/2018 01:51 PM
0003-Update-Status-Code.patch (3.93 KB) 0003-Update-Status-Code.patch znz (Kazuhiro NISHIYAMA), 01/05/2018 01:51 PM

Associated revisions

Revision 61633
Added by kazu 17 days ago

Specify frozen_string_literal: true

History

#1 [ruby-core:84646] Updated by normalperson (Eric Wong) 17 days ago

zn@mbf.nifty.com wrote:

0001-Specify-frozen_string_literal-true.patch (697 Bytes)

0001 seems pointless, only strings in that file are literal hash
keys and they are all frozen since 2.1
(I also wrote
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/438693
the other day)

0002-Add-103-Early-Hints.patch (1.11 KB)

Seems fine.

0003-Update-Status-Code.patch (3.93 KB)

Thank you for keeping old constants for compatibility. I guess
new constants are nice for people reading current documentation;
but they add cognitive overhead for users experienced with the
old names :<

I wonder if we should slowly move towards using classes based on
the numbers instead, and leave the unstable English phrasing out
of our API...

#2 [ruby-core:84659] Updated by naruse (Yui NARUSE) 17 days ago

Looks fine.
Could you commit them?

0001-Specify-frozen_string_literal-true.patch (697 Bytes)

0001 seems pointless, only strings in that file are literal hash
keys and they are all frozen since 2.1

This patch actually does nothing.
But it prevents that a future change accidentally adds mutable strings.
This change also fine to me.

#3 [ruby-core:84670] Updated by znz (Kazuhiro NISHIYAMA) 17 days ago

  • Status changed from Open to Closed

I commited at r61633, r61634, r61635.

#4 [ruby-core:84831] Updated by znz (Kazuhiro NISHIYAMA) 11 days ago

I wonder if we should slowly move towards using classes based on
the numbers instead, and leave the unstable English phrasing out
of our API...

I think Net::HTTP::STATUS_CODES is added for such purpose.
https://bugs.ruby-lang.org/issues/12935

Also available in: Atom PDF