Browse Source

Return pipeline metadata in pipeline route

feature/add-pipeline-endpoints
Fabian Vowie 3 years ago
parent
commit
bee20a159c
No known key found for this signature in database GPG Key ID: C27317C33B27C410
  1. 2
      main.go
  2. 3
      main_test.go

2
main.go

@ -17,7 +17,7 @@ type Metadata struct {
func PipelineHandle(pipeline IPipeline, w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
json.NewEncoder(w).Encode(true)
json.NewEncoder(w).Encode(pipeline)
}
func IndexHandler(w http.ResponseWriter, r *http.Request) {

3
main_test.go

@ -1,6 +1,7 @@
package main
import (
"encoding/json"
"net/http"
"net/http/httptest"
"testing"
@ -50,6 +51,8 @@ func TestEndpointRoute(t *testing.T) {
router.ServeHTTP(responseRecorder, request)
assert.Equal(t, responseRecorder.Code, 200)
body, _ := json.Marshal(givenEndpoint)
assert.JSONEq(t, string(body), responseRecorder.Body.String())
})
t.Run("Unregistered pipelines return 404", func(t *testing.T) {

Loading…
Cancel
Save