Skip to content

Commit 9311b30

Browse files
committed
Simpler
1 parent 2b5acd2 commit 9311b30

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

lib/executor/src/executors/http.rs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,9 @@ impl HTTPSubgraphExecutor {
168168
}
169169
};
170170

171-
let hmac_signature_ext = if should_sign_hmac {
171+
let mut first_extension = true;
172+
173+
if should_sign_hmac {
172174
if self.config.hmac_signature.secret.is_empty() {
173175
return Err(SubgraphExecutorError::HMACSignatureError(
174176
"HMAC signature secret is empty".to_string(),
@@ -186,14 +188,6 @@ impl HTTPSubgraphExecutor {
186188
mac.update(&body_without_extensions);
187189
let result = mac.finalize();
188190
let result_bytes = result.into_bytes();
189-
Some(result_bytes)
190-
} else {
191-
None
192-
};
193-
194-
let mut first_extension = true;
195-
196-
if let Some(hmac_bytes) = hmac_signature_ext {
197191
if first_extension {
198192
body.put(FIRST_EXTENSION_STR);
199193
first_extension = false;
@@ -204,7 +198,7 @@ impl HTTPSubgraphExecutor {
204198
body.put(self.config.hmac_signature.extension_name.as_bytes());
205199
body.put(QUOTE);
206200
body.put(COLON);
207-
let hmac_hex = hex::encode(hmac_bytes);
201+
let hmac_hex = hex::encode(result_bytes);
208202
body.put(QUOTE);
209203
body.put(hmac_hex.as_bytes());
210204
body.put(QUOTE);

0 commit comments

Comments
 (0)