Skip to content

Conversation

@wangkuiyi
Copy link
Contributor

No description provided.

Copy link
Collaborator

@reyoung reyoung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, but need some other to review further.


png, e := ioutil.ReadFile(pngFile)
candy.Must(e)
_, e = w.Write(png)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we change HTTP response header for PNG file?

  • Content-Type to image/png
  • Content-Length to image byte size.

Is them important for golang? will them be set automatically?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, Content-Type http package will not know, so programmer have to set if she wishes.
Content-Length I think will be automatically set by http package.
Anyway, I think most of the browsers are able to detect Content-Type if it's not set. For png file there will be a png signature at the beginning of the png binary.

Copy link

@helinwang helinwang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!


png, e := ioutil.ReadFile(pngFile)
candy.Must(e)
_, e = w.Write(png)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, Content-Type http package will not know, so programmer have to set if she wishes.
Content-Length I think will be automatically set by http package.
Anyway, I think most of the browsers are able to detect Content-Type if it's not set. For png file there will be a png signature at the beginning of the png binary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants