github.com/blend/go-sdk@v1.20220411.3/web/json_result.go (about)

     1  /*
     2  
     3  Copyright (c) 2022 - Present. Blend Labs, Inc. All rights reserved
     4  Use of this source code is governed by a MIT license that can be found in the LICENSE file.
     5  
     6  */
     7  
     8  package web
     9  
    10  import "github.com/blend/go-sdk/webutil"
    11  
    12  // JSONResult is a json result.
    13  type JSONResult struct {
    14  	StatusCode int
    15  	Response   interface{}
    16  }
    17  
    18  // Render renders the result
    19  func (jr *JSONResult) Render(ctx *Ctx) error {
    20  	return webutil.WriteJSON(ctx.Response, jr.StatusCode, jr.Response)
    21  }