diff --git a/internal/server/services/types.go b/internal/server/services/types.go index ee35086..85b0242 100644 --- a/internal/server/services/types.go +++ b/internal/server/services/types.go @@ -9,6 +9,7 @@ import ( // NewPasteOptions contains configuration options for creating a new paste type NewPasteOptions struct { + Content string // Content to be pasted Extension string // File extension (optional) ExpiresAt *time.Time // Expiration time for the paste Private bool // Whether the paste is private diff --git a/internal/server/tests/paste_test.go b/internal/server/tests/paste_test.go index e23c6ff..4d24afa 100644 --- a/internal/server/tests/paste_test.go +++ b/internal/server/tests/paste_test.go @@ -333,3 +333,33 @@ func TestRawPasteUpload(t *testing.T) { }) } } + +// func TestViewPaste(t *testing.T) { +// env := testutils.SetupTestEnv(t) +// defer env.CleanupFn() + +// // Create paste +// body := `{"content": "test content", "filename": "test.txt", "extension": "txt", "private": false}` +// req := httptest.NewRequest("POST", "/p/", strings.NewReader(body)) +// req.Header.Set("Content-Type", "application/json") + +// resp, err := env.App.Test(req) +// require.NoError(t, err) + +// // Parse response +// var paste services.NewPasteResponse +// err = json.NewDecoder(resp.Body).Decode(&paste) +// require.NoError(t, err) + +// fmt.Println(paste) + +// // View paste +// req = httptest.NewRequest("GET", fmt.Sprintf("/p/%s.txt", paste.ID), nil) +// resp, err = env.App.Test(req) +// require.NoError(t, err) + +// bodytext, _ := io.ReadAll(resp.Body) +// fmt.Println(string(bodytext)) + +// assert.Equal(t, 200, resp.StatusCode) +// }