File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -41,16 +41,18 @@ impl Event {
41
41
handle. post ( true ) ?;
42
42
handle. http_headers ( headers) ?;
43
43
44
- let full_event = FullEvent { service_key, event : self } ;
44
+ let full_event = FullEvent {
45
+ service_key,
46
+ event : self ,
47
+ } ;
45
48
let json_body = serde_json:: to_string ( & full_event) ?;
46
49
let mut bytes_to_write = json_body. as_bytes ( ) ;
47
50
let mut data = Vec :: new ( ) ;
48
51
49
52
{
50
53
let mut handle = handle. transfer ( ) ;
51
- handle. read_function ( |bytes| {
52
- bytes_to_write. read ( bytes) . map_err ( |_| ReadError :: Abort )
53
- } ) ?;
54
+ handle
55
+ . read_function ( |bytes| bytes_to_write. read ( bytes) . map_err ( |_| ReadError :: Abort ) ) ?;
54
56
handle. write_function ( |buf| {
55
57
data. extend_from_slice ( buf) ;
56
58
Ok ( buf. len ( ) )
@@ -63,12 +65,14 @@ impl Event {
63
65
400 => {
64
66
let error = serde_json:: from_slice :: < InvalidEvent > ( & data) ?;
65
67
Err ( internal ( & format_args ! ( "pagerduty error: {:?}" , error) ) )
66
- } ,
68
+ }
67
69
403 => Err ( internal ( "rate limited by pagerduty" ) ) ,
68
70
n => {
69
71
let resp = String :: from_utf8_lossy ( & data) ;
70
72
Err ( internal ( & format_args ! (
71
- "Got a non 200 response code from pagerduty: {} with {}" , n, resp) ) )
73
+ "Got a non 200 response code from pagerduty: {} with {}" ,
74
+ n, resp
75
+ ) ) )
72
76
}
73
77
}
74
78
}
You can’t perform that action at this time.
0 commit comments