diff --git a/notification-core/src/main/java/org/opengroup/osdu/notification/di/CredentialHeadersProvider.java b/notification-core/src/main/java/org/opengroup/osdu/notification/di/CredentialHeadersProvider.java
index 7ee884e2f3b2de8042f016e574deb425983c40ea..30252493e4828485951c62f040ce612ad1d4ceba 100644
--- a/notification-core/src/main/java/org/opengroup/osdu/notification/di/CredentialHeadersProvider.java
+++ b/notification-core/src/main/java/org/opengroup/osdu/notification/di/CredentialHeadersProvider.java
@@ -52,17 +52,17 @@ public class CredentialHeadersProvider implements FactoryBean<DpsHeaders> {
     @Override
     public DpsHeaders getObject() throws Exception {
 
-        if(this.pubsubRequestBodyExtractor.isHandshakeRequest()) {
-            // The headers are not needed for the handshake requests.
-            return new DpsHeaders();
-        }
-
         RequestMethod requestMethod = RequestMethod.valueOf(httpRequest.getMethod());
 
         switch (requestMethod) {
             case POST:
             case PUT:
             case PATCH: {
+                if(this.pubsubRequestBodyExtractor.isHandshakeRequest()) {
+                    // The headers are not needed for the handshake requests.
+                    return new DpsHeaders();
+                }
+
                 Map<String, String> attributes = this.pubsubRequestBodyExtractor.extractAttributesFromRequestBody();
                 try {
                     //extract headers from pubsub message