mirror of
https://github.com/lukaszraczylo/go-simple-graphql.git
synced 2026-10-14 00:58:32 +00:00
Compare commits
7
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c7d59e4729 | ||
|
|
8bc6eaf181 | ||
|
|
3b7f44f455 | ||
|
|
3d042d8395 | ||
|
|
7056959d0e | ||
|
|
9a01f87421 | ||
|
|
3d89a77565 |
@@ -0,0 +1 @@
|
|||||||
|
This is a dummy change for PR #1
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
This is a dummy change for PR #10
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
This is a dummy change for PR #11
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
This is a dummy change for PR #12
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
This is a dummy change for PR #2
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
This is a dummy change for PR #3
|
||||||
+1
-1
@@ -48,6 +48,6 @@ func (b *BaseClient) decodeResponse(response []byte) (any, error) {
|
|||||||
Message: "Can't decode response",
|
Message: "Can't decode response",
|
||||||
Pairs: map[string]interface{}{"error": "unknown response type"},
|
Pairs: map[string]interface{}{"error": "unknown response type"},
|
||||||
})
|
})
|
||||||
return nil, fmt.Errorf("Can't decode response - unknown response type specified")
|
return nil, fmt.Errorf("can't decode response - unknown response type specified")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,11 +58,11 @@ func Benchmark_NewLogger(b *testing.B) {
|
|||||||
got := New()
|
got := New()
|
||||||
|
|
||||||
if tt.triggers.ModFormat.Format != "" {
|
if tt.triggers.ModFormat.Format != "" {
|
||||||
got = got.SetFormat(tt.triggers.ModFormat.Format)
|
got.SetFormat(tt.triggers.ModFormat.Format)
|
||||||
}
|
}
|
||||||
|
|
||||||
if tt.triggers.ModLevel.Level != 0 {
|
if tt.triggers.ModLevel.Level != 0 {
|
||||||
got = got.SetMinLogLevel(tt.triggers.ModLevel.Level)
|
got.SetMinLogLevel(tt.triggers.ModLevel.Level)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package libpack_logger
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@@ -11,30 +10,6 @@ import (
|
|||||||
"github.com/goccy/go-reflect"
|
"github.com/goccy/go-reflect"
|
||||||
)
|
)
|
||||||
|
|
||||||
func captureStderr(f func()) string {
|
|
||||||
originalStderr := os.Stderr
|
|
||||||
r, w, _ := os.Pipe()
|
|
||||||
os.Stderr = w
|
|
||||||
f()
|
|
||||||
w.Close()
|
|
||||||
var buf bytes.Buffer
|
|
||||||
buf.ReadFrom(r)
|
|
||||||
os.Stderr = originalStderr
|
|
||||||
return buf.String()
|
|
||||||
}
|
|
||||||
|
|
||||||
func captureStdOut(f func()) string {
|
|
||||||
originalStdout := os.Stdout
|
|
||||||
r, w, _ := os.Pipe()
|
|
||||||
os.Stdout = w
|
|
||||||
f()
|
|
||||||
w.Close()
|
|
||||||
var buf bytes.Buffer
|
|
||||||
buf.ReadFrom(r)
|
|
||||||
os.Stdout = originalStdout
|
|
||||||
return buf.String()
|
|
||||||
}
|
|
||||||
|
|
||||||
func (suite *LoggerTestSuite) Test_LogMessageString() {
|
func (suite *LoggerTestSuite) Test_LogMessageString() {
|
||||||
msg := &LogMessage{
|
msg := &LogMessage{
|
||||||
Message: "test message",
|
Message: "test message",
|
||||||
|
|||||||
+2
-2
@@ -3,7 +3,7 @@ package gql
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/http/httptest"
|
"net/http/httptest"
|
||||||
"strings"
|
"strings"
|
||||||
@@ -15,7 +15,7 @@ func StartMockServer() *httptest.Server {
|
|||||||
// Create your handler
|
// Create your handler
|
||||||
handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
// Your existing handler code
|
// Your existing handler code
|
||||||
bodyBytes, err := ioutil.ReadAll(r.Body)
|
bodyBytes, err := io.ReadAll(r.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
w.WriteHeader(http.StatusInternalServerError)
|
w.WriteHeader(http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user