You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[This is a template for Go's change proposal process, documented here.]
Proposal: New Constants for MIME types in net/http pkg
Author(s): Salamandastron1
Last updated: 10/5/2021
Abstract
The idea is to include these common MIME type values as constants in the net/http pkg. These values are an incredibly important part of the HTTP contract between client and server and leave a lot of room for mistakes while typing them. For ease of programming and reduced error, I believe they should be included as constants.
Background
Not much to say, Mime type values, such as JSON, HTML, Plain text, etc are common and unlikely to change. However, having to type out these values whenever needed is cumbersome and better handled as immutable values in the net/http pkg
Proposal
I propose that the various "Content-Type" options (including the key of "Content-Type") be included as constants in the net/http package. e.g.
The proposed change would result in ease of programming and reduced errors, for beginners and veterans alike. We are beyond the point of needing to type out these regulated values.
Trade-Offs:
Advantages
reduced errors
ease of programming
Disadvantages
net/http package would increase in size
while unlikely, changes to any of the aforementioned specifications and beyond could create toil by the need to update the constant values
Compatibility
There should be no change in compatibility
Implementation
Adding the constants into the already existing list on net/http
These changes could be deployed with any upcoming release. There are no security, reliability, or backward compatibility concerns.
Open issues (if applicable)
n/a
The text was updated successfully, but these errors were encountered:
seankhliao
changed the title
Proposal: New Constants for MIME types in *net/http* pkg
proposal: net/http: add constants for mime types
Oct 5, 2021
[This is a template for Go's change proposal process, documented here.]
Proposal: New Constants for MIME types in net/http pkg
Author(s): Salamandastron1
Last updated: 10/5/2021
Abstract
The idea is to include these common MIME type values as constants in the net/http pkg. These values are an incredibly important part of the HTTP contract between client and server and leave a lot of room for mistakes while typing them. For ease of programming and reduced error, I believe they should be included as constants.
Background
Not much to say, Mime type values, such as JSON, HTML, Plain text, etc are common and unlikely to change. However, having to type out these values whenever needed is cumbersome and better handled as immutable values in the net/http pkg
Proposal
I propose that the various
"Content-Type"
options (including the key of"Content-Type"
) be included as constants in the net/http package. e.g.Rationale
The proposed change would result in ease of programming and reduced errors, for beginners and veterans alike. We are beyond the point of needing to type out these regulated values.
Trade-Offs:
Compatibility
There should be no change in compatibility
Implementation
Adding the constants into the already existing list on net/http
These changes could be deployed with any upcoming release. There are no security, reliability, or backward compatibility concerns.
Open issues (if applicable)
n/a
The text was updated successfully, but these errors were encountered: