Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix panic wrote more than the declared Content-Length #317

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 5 additions & 6 deletions context/render.go
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
package context

import (
"bytes"
"encoding/xml"
"net/http"
"io"
)

var xmlContentType = []string{"application/xml; charset=utf-8"}
var plainContentType = []string{"text/plain; charset=utf-8"}

//Render render from bytes
func (ctx *Context) Render(bytes []byte) {
func (ctx *Context) Render(bytes1 []byte) {
//debug
//fmt.Println("response msg = ", string(bytes))
ctx.Writer.WriteHeader(200)
_, err := ctx.Writer.Write(bytes)
if err != nil {
panic(err)
}
bytesBuffer := bytes.NewBuffer(bytes1)
io.Copy(ctx.Writer, bytesBuffer)
}

//String render from string
Expand Down