Commit 3bc05501 authored by Komal Makkar's avatar Komal Makkar
Browse files

Extracting the core logic in a method

parent 4c581f85
Pipeline #13968 passed with stages
in 20 minutes and 39 seconds
......@@ -57,7 +57,16 @@ public class CredentialHeadersProvider implements FactoryBean<DpsHeaders> {
switch (requestMethod) {
case POST:
case PUT:
case PATCH: {
case PATCH:
return getDpsHeadersForPostPutPatch();
default: {
return new DpsHeaders();
}
}
}
private DpsHeaders getDpsHeadersForPostPutPatch() throws Exception {
if(this.pubsubRequestBodyExtractor.isHandshakeRequest()) {
// The headers are not needed for the handshake requests.
return new DpsHeaders();
......@@ -74,10 +83,4 @@ public class CredentialHeadersProvider implements FactoryBean<DpsHeaders> {
throw new Exception("Failed to generate headers for register service.");
}
}
default: {
return new DpsHeaders();
}
}
}
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment