Official Content

Adds a header to the HTTP header.

Syntax

&DataType.AddHeader(Name, Value)

Where:
&DataType
     Variable name based on an HttpClient or an HttpResponse data type.

Name
   Name of the header, must be string.

Value
   Value of the header, must be string.

Scope

Extended Data Types: HttpClient, HttpResponse
Generators:  .NET.NET FrameworkJava

Samples

&httpresponse.AddHeader(!"User-Agent",!"GeneXus")
// &httpresponse is HttpResponse data type

The former line sets the “User-Agent” header with the “GeneXus” value

&HttpResponse.AddHeader(!'Content-Disposition',!'attachment; filename="WhatsApp Image 2020-01-10 at 12.45.59.jpeg"') 

The former line is part of the code of probably a procedure with Call protocol property set to 'HTTP' that returns a file. The line sets the Content-Disposition header so that the file downloaded to the browser with the name "WhatsApp Image 2020-01-10 at 12.45.59.jpeg"

See Also

HttpClient data type
HttpResponse data type

 

Last update: February 2024 | © GeneXus. All rights reserved. GeneXus Powered by Globant