Skip to content

Commit

Permalink
stop using removed h.WriteResponse method
Browse files Browse the repository at this point in the history
  • Loading branch information
daaku committed Sep 19, 2015
1 parent 7dd35f9 commit 8e93030
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 16 deletions.
12 changes: 6 additions & 6 deletions examples/viewexamples/examples.go
Expand Up @@ -78,13 +78,13 @@ func (a *Handler) List(ctx context.Context, w http.ResponseWriter, r *http.Reque
if err != nil {
return err
}
h.WriteResponse(ctx, w, r, &examplesList{
_, err = h.Write(ctx, w, &examplesList{
Context: ctx,
Env: env,
Static: a.Static,
DB: a.ExampleStore.DB,
})
return nil
return err
}

func (a *Handler) PostSaved(ctx context.Context, w http.ResponseWriter, r *http.Request) error {
Expand Down Expand Up @@ -120,7 +120,7 @@ func (a *Handler) GetSaved(ctx context.Context, w http.ResponseWriter, r *http.R
if err != nil {
return err
}
h.WriteResponse(ctx, w, r, &page{
_, err = h.Write(ctx, w, &page{
Writer: w,
Request: r,
Context: ctx,
Expand All @@ -129,15 +129,15 @@ func (a *Handler) GetSaved(ctx context.Context, w http.ResponseWriter, r *http.R
Example: example,
Xsrf: a.Xsrf,
})
return nil
return err
}

func (a *Handler) Example(ctx context.Context, w http.ResponseWriter, r *http.Request) error {
env, example, err := a.parse(ctx, r)
if err != nil {
return err
}
h.WriteResponse(ctx, w, r, &page{
_, err = h.Write(ctx, w, &page{
Writer: w,
Request: r,
Context: ctx,
Expand All @@ -146,7 +146,7 @@ func (a *Handler) Example(ctx context.Context, w http.ResponseWriter, r *http.Re
Example: example,
Xsrf: a.Xsrf,
})
return nil
return err
}

type page struct {
Expand Down
11 changes: 6 additions & 5 deletions oauth/oauth.go
Expand Up @@ -51,10 +51,10 @@ func (a *Handler) Handler(ctx context.Context, w http.ResponseWriter, r *http.Re
}
w.Header().Set("Content-Type", "text/html; charset=utf-8")
w.WriteHeader(http.StatusNotFound)
h.WriteResponse(ctx, w, r, &h.Script{
_, err := h.Write(ctx, w, &h.Script{
Inner: h.Unsafe("top.location='/'"),
})
return nil
return err
}

func (a *Handler) Start(ctx context.Context, w http.ResponseWriter, r *http.Request) error {
Expand Down Expand Up @@ -87,9 +87,10 @@ func (a *Handler) Start(ctx context.Context, w http.ResponseWriter, r *http.Requ
http.Redirect(w, r, dialogURL.String(), 302)
} else {
b, _ := json.Marshal(dialogURL.String())
h.WriteResponse(ctx, w, r, &h.Script{
_, err := h.Write(ctx, w, &h.Script{
Inner: h.Unsafe(fmt.Sprintf("top.location=%s", b)),
})
return err
}
return nil
}
Expand Down Expand Up @@ -130,11 +131,11 @@ func (a *Handler) Response(ctx context.Context, w http.ResponseWriter, r *http.R
if err != nil {
return ctxerr.Wrap(ctx, err)
}
h.WriteResponse(ctx, w, r, &h.Frag{
_, err = h.Write(ctx, w, &h.Frag{
&h.Script{Inner: h.Unsafe("window.location.hash = ''")},
h.String(string(bd)),
})
return nil
return err
}

func (a *Handler) state(w http.ResponseWriter, r *http.Request) string {
Expand Down
8 changes: 4 additions & 4 deletions og/viewog/og.go
Expand Up @@ -43,8 +43,8 @@ func (a *Handler) Values(ctx context.Context, w http.ResponseWriter, r *http.Req
if err != nil {
return err
}
h.WriteResponse(ctx, w, r, renderObject(ctx, env, a.Static, object))
return nil
_, err = h.Write(ctx, w, renderObject(ctx, env, a.Static, object))
return err
}

// Handles /rog/* requests.
Expand All @@ -61,8 +61,8 @@ func (a *Handler) Base64(ctx context.Context, w http.ResponseWriter, r *http.Req
if err != nil {
return err
}
h.WriteResponse(ctx, w, r, renderObject(ctx, env, a.Static, object))
return nil
_, err = h.Write(ctx, w, renderObject(ctx, env, a.Static, object))
return err
}

// Handles /rog-redirect/ requests.
Expand Down
2 changes: 1 addition & 1 deletion view/error.go
Expand Up @@ -44,7 +44,7 @@ func (err errorCodeHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
&h.Script{Inner: h.Unsafe("window.location.hash = ''")},
},
}
h.WriteResponse(context.TODO(), w, r, page)
h.Write(context.TODO(), w, page)
}
}

Expand Down

0 comments on commit 8e93030

Please sign in to comment.