snapshot of https://github.com/ory/kratos.git (master, 2026-09-15; blobs > 131072B omitted)
Some checks failed
CI / Run tests and lints (push) Failing after 29s
CI / Build CLI docs (push) Has been skipped
CI / Run Playwright end-to-end tests (mysql) (push) Failing after 3s
CI / Run Playwright end-to-end tests (postgres) (push) Failing after 2s
CI / Run Playwright end-to-end tests (sqlite) (push) Failing after 3s
CodeQL / Analyze (go) (push) Failing after 4s
CodeQL / Analyze (javascript) (push) Failing after 3s
Docker Image Scanners / scanners (push) Failing after 4s
Synchronize Issue Labels / Synchronize Issue Labels (push) Has been skipped
CI / Run end-to-end tests (postgres) (push) Failing after 19s
CI / Run end-to-end tests (sqlite) (push) Failing after 2s
CI / Run Playwright end-to-end tests (cockroach) (push) Failing after 2s
CI / Draft newsletter (push) Has been skipped
CI / Generate release (push) Has been skipped
CI / Pending approval Slack notification (push) Has been skipped
CI / Send newsletter (push) Has been skipped
Some checks failed
CI / Run tests and lints (push) Failing after 29s
CI / Build CLI docs (push) Has been skipped
CI / Run Playwright end-to-end tests (mysql) (push) Failing after 3s
CI / Run Playwright end-to-end tests (postgres) (push) Failing after 2s
CI / Run Playwright end-to-end tests (sqlite) (push) Failing after 3s
CodeQL / Analyze (go) (push) Failing after 4s
CodeQL / Analyze (javascript) (push) Failing after 3s
Docker Image Scanners / scanners (push) Failing after 4s
Synchronize Issue Labels / Synchronize Issue Labels (push) Has been skipped
CI / Run end-to-end tests (postgres) (push) Failing after 19s
CI / Run end-to-end tests (sqlite) (push) Failing after 2s
CI / Run Playwright end-to-end tests (cockroach) (push) Failing after 2s
CI / Draft newsletter (push) Has been skipped
CI / Generate release (push) Has been skipped
CI / Pending approval Slack notification (push) Has been skipped
CI / Send newsletter (push) Has been skipped
This commit is contained in:
3
test/e2e/mock/httptarget/go.mod
Normal file
3
test/e2e/mock/httptarget/go.mod
Normal file
@@ -0,0 +1,3 @@
|
||||
module github.com/ory/mock
|
||||
|
||||
go 1.26
|
||||
0
test/e2e/mock/httptarget/go.sum
Normal file
0
test/e2e/mock/httptarget/go.sum
Normal file
67
test/e2e/mock/httptarget/main.go
Normal file
67
test/e2e/mock/httptarget/main.go
Normal file
@@ -0,0 +1,67 @@
|
||||
// Copyright © 2024 Ory Corp
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"cmp"
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
"sync"
|
||||
)
|
||||
|
||||
var (
|
||||
documentsLock sync.RWMutex
|
||||
documents = make(map[string][]byte)
|
||||
)
|
||||
|
||||
func main() {
|
||||
port := cmp.Or(os.Getenv("PORT"), "4471")
|
||||
log.Fatal(http.ListenAndServe(fmt.Sprintf(":%s", port), nil))
|
||||
}
|
||||
|
||||
func init() {
|
||||
http.HandleFunc("/health", func(w http.ResponseWriter, r *http.Request) {
|
||||
_, _ = w.Write([]byte("OK"))
|
||||
})
|
||||
|
||||
http.HandleFunc("GET /documents/{id}", func(w http.ResponseWriter, r *http.Request) {
|
||||
id := r.PathValue("id")
|
||||
|
||||
documentsLock.RLock()
|
||||
doc, ok := documents[id]
|
||||
documentsLock.RUnlock()
|
||||
|
||||
if ok {
|
||||
_, _ = w.Write(doc)
|
||||
} else {
|
||||
w.WriteHeader(http.StatusNotFound)
|
||||
}
|
||||
})
|
||||
|
||||
http.HandleFunc("PUT /documents/{id}", func(w http.ResponseWriter, r *http.Request) {
|
||||
documentsLock.Lock()
|
||||
defer documentsLock.Unlock()
|
||||
id := r.PathValue("id")
|
||||
|
||||
body, err := io.ReadAll(r.Body)
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
||||
documents[id] = body
|
||||
})
|
||||
|
||||
http.HandleFunc("DELETE /documents/{id}", func(w http.ResponseWriter, r *http.Request) {
|
||||
documentsLock.Lock()
|
||||
defer documentsLock.Unlock()
|
||||
id := r.PathValue("id")
|
||||
|
||||
delete(documents, id)
|
||||
w.WriteHeader(http.StatusNoContent)
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user