ref: move httpapi.Reponse into codersdk (#2954)

This commit is contained in:
Jon Ayers
2022-07-12 19:15:02 -05:00
committed by GitHub
parent dde51f1caa
commit 7e9819f2a8
53 changed files with 524 additions and 486 deletions

View File

@ -12,6 +12,7 @@ import (
"github.com/stretchr/testify/require"
"github.com/coder/coder/coderd/httpapi"
"github.com/coder/coder/codersdk"
)
func TestWrite(t *testing.T) {
@ -19,7 +20,7 @@ func TestWrite(t *testing.T) {
t.Run("NoErrors", func(t *testing.T) {
t.Parallel()
rw := httptest.NewRecorder()
httpapi.Write(rw, http.StatusOK, httpapi.Response{
httpapi.Write(rw, http.StatusOK, codersdk.Response{
Message: "Wow.",
})
var m map[string]interface{}
@ -71,7 +72,7 @@ func TestRead(t *testing.T) {
var validate toValidate
require.False(t, httpapi.Read(rw, r, &validate))
var v httpapi.Response
var v codersdk.Response
err := json.NewDecoder(rw.Body).Decode(&v)
require.NoError(t, err)
require.Len(t, v.Validations, 1)