underscore in html address change to space

I have a problem with a query to the server. Board ESP8266.
I need to download a json file. The server returns the "301 Moved Permanently" error when sending a
request (server, getservices)

String GETSERVICES = "/averageGET_SERVICES&hash=bnmmbb1";

void setup() {
  Serial.begin(115200);        
  delay(10);
  Serial.println('\n');
  
  WiFi.begin(ssid, password);             
  Serial.print("Connecting to ");
  Serial.print(ssid); Serial.println(" ...");

  int i = 0;
  while (WiFi.status() != WL_CONNECTED) { 
      delay(1000);
      Serial.print(++i); Serial.print(' ');
    }

  Serial.println('\n');
  Serial.println("Connection established!");  
  Serial.print("IP address:\t");
  Serial.println(WiFi.localIP());         
  if (connect(server)){
  if(sendRequest(server, GETSERVICES) && skipResponseHeaders()) {
 Serial.println(client.readString()); // Here I get 301 error
  DynamicJsonDocument doc(1024);
  DeserializationError error = deserializeJson(doc, client);
    if (error) {
    Serial.print(F("deserializeJson() failed: "));
    Serial.println(error.c_str());
    return;}
  }
  
  }
 
}

void loop() {
}
bool connect(String hostName) {
  Serial.print("Connect to ");
  Serial.println(hostName);

  bool ok = client.connect(hostName, 80);

  Serial.println(ok ? "Connected" : "Connection Failed!");
  return ok;
}
// Send the HTTP GET request to the server
bool sendRequest(String host, String resource) {
  Serial.print("GET ");
  Serial.println(resource);

  client.print("GET ");
  client.print(resource);
  client.println(" HTTP/1.1");
  client.print("Host: ");
  client.println(host);
  client.println("Connection: close");
  client.println();

  return true;
}

// Skip HTTP headers so that we are at the beginning of the response's body
bool skipResponseHeaders() {
  // HTTP headers end with an empty line
  char endOfHeaders[] = "\r\n\r\n";

  client.setTimeout(HTTP_TIMEOUT);
  bool ok = client.find(endOfHeaders);

  if (!ok) {
      Serial.println("No response or invalid response!");
    }
  return ok;
}

But getservices contains the string "xxxGET_SERVICESxxx" and "_" is replaced with space " ". This is probably a problem. What can I do with that?

I would not expect an _ to be turned into a space - but you have not posted code that reproduces this behavior, nor what board you're using and so on, so you haven't given us enough to provide more specific help. See the how to use this forum thread for information on how to post code so we can easily read it.

Also, please don't ignore the text at the top of the forum section that says that this section is not for questions about your project. This section is for IDE/board problems, not help with your project, I have asked the moderators to move your question to the appropriate section.