File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ function iclogger_guzzle_middleware(LoggerInterface $log, $type = 'raw')
12
12
$ method = (string ) $ request ->getMethod ();
13
13
$ uri = (string ) $ request ->getUri ();
14
14
$ body = (string ) $ request ->getBody ();
15
-
15
+
16
16
if (empty ($ body )) {
17
17
$ message = "[ {$ method }] Calling ` {$ uri }`. " ;
18
18
$ context = [];
@@ -31,12 +31,12 @@ function iclogger_guzzle_middleware(LoggerInterface $log, $type = 'raw')
31
31
}
32
32
}
33
33
$ log ->info ($ message , $ context );
34
-
34
+
35
35
return $ handler ($ request , $ options )->then (
36
36
function ($ response ) use ($ log , $ type ) {
37
37
$ body = (string ) $ response ->getBody ();
38
38
$ code = $ response ->getStatusCode ();
39
-
39
+
40
40
$ message = "[ {$ code }] Response: " ;
41
41
switch ($ type ) {
42
42
case 'json ' :
@@ -45,7 +45,7 @@ function ($response) use ($log, $type) {
45
45
throw new RuntimeException ('Bad response, json expected. ' , ['response ' => $ body ]);
46
46
}
47
47
break ;
48
-
48
+
49
49
case 'raw ' :
50
50
default :
51
51
$ message .= "\n{$ body }" ;
@@ -55,9 +55,9 @@ function ($response) use ($log, $type) {
55
55
if (!empty ($ context )) {
56
56
$ response ->iclParsedBody = $ context ;
57
57
}
58
-
58
+
59
59
$ log ->info ($ message , $ context );
60
-
60
+
61
61
return $ response ;
62
62
},
63
63
function ($ reason ) {
You can’t perform that action at this time.
0 commit comments