From f74f71b2e1ea955bccd8faca096f2848f666c030 Mon Sep 17 00:00:00 2001
From: "ext.sopra.yvallet@grandlyon.com" <ext.sopra.yvallet@grandlyon.com>
Date: Mon, 19 Oct 2020 17:18:03 +0200
Subject: [PATCH] fix http Error for grdf_token

---
 main.go | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/main.go b/main.go
index f65edad..0453c72 100644
--- a/main.go
+++ b/main.go
@@ -507,7 +507,9 @@ func main() {
 							if err != nil {
 								log.Error(err.Error())
 								http.Error(w, err.Error(), 500)
+								return
 							}
+							log.Debug("Consentements found : ", token.Consentements)
 							// Decode the consentement information
 							if len(token.Consentements) > 0 {
 								var consentements GrdfConsentement
@@ -515,6 +517,7 @@ func main() {
 								if err2 != nil {
 									log.Error(err2.Error())
 									http.Error(w, err2.Error(), 500)
+									return
 								}
 								if len(consentements[0].Pce) > 0 {
 									pce = consentements[0].Pce
@@ -525,6 +528,7 @@ func main() {
 					if len(pce) <= 0 {
 						log.Error("No PCE found")
 						http.Error(w, http.StatusText(500), 500)
+						return
 					}
 				} else {
 					http.Error(w, http.StatusText(response.StatusCode), response.StatusCode)
-- 
GitLab