Clear GET request after executed

Hey, I'm making a systems that checks if the RFID is in a database. The code is working for the first request:

/gates/check?pid=7676dd95&sid=RFID0010
Response: {"access":1}

but when i put a second RFID pass on it, the link generates after the first link giving me:

/gates/check?pid=7676dd95&sid=RFID0010/gates/check?pid=77b397c1&sid=RFID0010
Response: {"access":1}

What it should be:

/gates/check?pid=77b397c1&sid=RFID0010
Response: {"access":1}

This is the code that I'm currently using:

#include <SPI.h>
#include <EEPROM.h> 
#include <Ethernet.h>
#include <ArduinoHttpClient.h>
#include <MFRC522.h>
#include <Servo.h>

#define COMMON_ANODE

#ifdef COMMON_ANODE
#define LED_ON LOW
#define LED_OFF HIGH
#else
#define LED_ON HIGH
#define LED_OFF LOW
#endif

#define redLed 7    // Set Led Pins
#define greenLed 6
#define blueLed 5

#define relay 4     // Set Relay Pin
#define wipeB 3     // Button pin for WipeMode

bool programMode = false;  // initialize programming mode to false

uint8_t successRead;    // Variable integer to keep if we have Successful Read from Reader

byte storedCard[4];   // Stores an ID read from EEPROM
byte readCard[4];   // Stores scanned ID read from RFID Module
byte masterCard[4]; 

/////// RFID Settings ///////
#define RST_PIN         3          
#define SS_PIN          4       
MFRC522 mfrc522(SS_PIN, RST_PIN);   // Create MFRC522 instance.

/////// Ethernet Settings ///////
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x13 };
IPAddress ip(192, 168, 1, 222);
char serverAddress[] = "192.168.1.41";  // server address
int port = 80;

/////// HttpClient Settings ///////
EthernetClient ethr;
HttpClient client = HttpClient(ethr, serverAddress, port);
String response;
int statusCode = 0;

/////// Keypad Settings ///////
/////// Servo Settings ///////
Servo lock; //declares servo

/////// Status Variables & Strings ///////
int rStatus = 0; // RFID Status
int pStatus = 0; // PIN Status
String registeredCard = "160196116163";
String getReq, tag, rfid, pincode;

void setup() {
  pinMode(redLed, OUTPUT);
  pinMode(greenLed, OUTPUT);
  pinMode(blueLed, OUTPUT);
  pinMode(wipeB, INPUT_PULLUP);   // Enable pin's pull up resistor
  pinMode(relay, OUTPUT);
  //Be careful how relay circuit behave on while resetting or power-cycling your Arduino
  digitalWrite(relay, HIGH);    // Make sure door is locked
  digitalWrite(redLed, LED_OFF);  // Make sure led is off
  digitalWrite(greenLed, LED_OFF);  // Make sure led is off
  digitalWrite(blueLed, LED_OFF); // Make sure led is off
  /////// Starting Serial ///////
  Serial.begin(9600);
  delay(1000);

  /////// Ethernet Setup ///////
  Serial.println("Initializing Ethernet.");
  Ethernet.begin(mac, ip);
  Serial.println("Connection Success.");
  Serial.println("");
  delay(1000);

  /////// RFID Setup ///////
  Serial.println("Initializing RFID Module.");
  mfrc522.PCD_Init();   // Initiate MFRC522
  Serial.println("RFID Ready.");
  Serial.println("");
  delay(1000);

  /////// Keypad Setup ///////

  Serial.println("Setting up servo motor...");
  lock.attach(13);
  Serial.println("Servo Motor Ready.");
  Serial.println("");
  delay(1000);

  Serial.println("Please tap RFID Card.");
}

void loop() {
  if (rStatus == 0)
  {
    readRFID();
  }

  if (rStatus == 1 && pStatus == 1)
  {
    lock.write(5);
    delay(5000);
    lock.write(0);
    rStatus = 0;
    pStatus = 0;

  }
}

/////// Module Methods - RFID ///////
void readRFID()
{
  // Look for new cards
  if ( ! mfrc522.PICC_IsNewCardPresent())
  {
    return;
  }
  // Select one of the cards
  if ( ! mfrc522.PICC_ReadCardSerial())
  {
    return;
  }

  //Show UID on serial monitor
  Serial.print("PID tag : ");
  String content = "";
  //byte letter;
  for (byte i = 0; i < mfrc522.uid.size; i++)
  {
    //Serial.print(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " ");
    //Serial.print(mfrc522.uid.uidByte[i], HEX);
    //content.concat(String(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " "));
    content.concat(String(mfrc522.uid.uidByte[i], HEX));
    //Serial.print(mfrc522.uid.uidByte[i]);
    //content.concat(String(mfrc522.uid.uidByte[i]));
  }
  Serial.println();
  Serial.println(content);
  tag = String(content);
  getRequest();
  //Serial.println(rfid);
}

/////// Module Methods - Keypad ///////

void getRequest() {
  //Serial.println("Making GET Request");
  getReq.concat("/gates/check?pid=");
  getReq.concat(tag);
  getReq.concat("&sid=RFID0010");
  client.get(getReq);
  Serial.println(getReq);

  // read the status code and body of the response
  //statusCode = client.responseStatusCode();
  response = client.responseBody();
  rfid = response;

  Serial.print("Response: ");
  Serial.println(response);

  delay(5000);
  return(true);
}

Does anyone know how this can be solved?

Before you do this:

  getReq.concat("/gates/check?pid=");

Set getReq to "".

wildbill:
Before you do this:

  getReq.concat("/gates/check?pid=");

Set getReq to "".

Hey, thanks for replying!

I found this out myself a few minutes before you posted this.

It works now.

CasBekhuis:
Hey, thanks for replying!

I found this out myself a few minutes before you posted this.

It works now.

Who said that people are not telepathic !