github.com/ethersphere/bee/v2@v2.2.0/pkg/jsonhttp/jsonhttptest/doc.go (about) 1 // Copyright 2020 The Swarm Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 /* 6 Package jsonhttptest helps with end-to-end testing of JSON-based HTTP APIs. 7 8 To test specific endpoint, Request function should be called with options that 9 should validate response from the server: 10 11 options := []jsonhttptest.Option{ 12 jsonhttptest.WithRequestHeader("Content-Type", "text/html"), 13 } 14 jsonhttptest.Request(t, client, http.MethodGet, "/", http.StatusOk, options...) 15 // ... 16 17 The HTTP request will be executed using the supplied client, and response 18 checked in expected status code is returned, as well as with each configured 19 option function. 20 */ 21 package jsonhttptest