\r\n

51Degrees Pipeline Node.js  4.4

51Degrees Pipeline for Node.js

SetHeadersElement Class Reference

Detailed Description

Set response headers element class.

This is used to get response headers based on what the browser supports. For example, newer Chrome browsers support the Accept-CH header.

Inheritance diagram for SetHeadersElement:

[legend]

Collaboration diagram for SetHeadersElement:

[legend]

Public Member Functions

 constructor ()
 getHeaderName (propertyName)
Get the name of the header which the property relates to. More...
 constructHeaders (pipeline)
Construct the headers and their properties which can be set by the service. More...
 processInternal (flowData)
Add the response header dictionary to the FlowData. More...
 getResponseHeaders (flowData)
Get response headers (e.g. More...
 tryGetValue (flowData, elementKey, propertyKey)
Try to get the value for the given element and property. More...

Public Member Functions inherited from FlowElement

 constructor ({ processInternal, dataKey, properties={}, evidenceKeyFilter }={})
Constructor for flowElement class. More...
 onRegistration (pipeline, flowElement)
Internal function to be called when a FlowElement is added to pipeline, runs through any registrationCallbacks on the FlowElement. More...
 ready ()
Function called to check if a FlowElement is ready Used when there are asynchronous initialisation steps. More...
 processInternal (flowData)
Internal process function for a particular flowElement called (via the flowElement.process() method) when flowData generated by a pipleline is processsed. More...
 process (flowData)
To allow actions to take place before and after a FlowElement's processInternal function runs, a process wrapper is run first. More...
 updateProperties ()
Call this function to update the properties meta database in all the pipelines this flowElement has been added to. More...
 getProperties ()
Get a flowElement's properties. More...
 _log (type, message)

Member Function Documentation

◆ constructHeaders()

SetHeadersElement::constructHeaders (   pipeline )
inline

Construct the headers and their properties which can be set by the service.

An example of the structure of the headers is: { 'Accept-CH': { name: 'Accept-CH', properties: [ 'device.SetHeaderBrowserAccept-CH', 'device.SetHeaderPlatformAccept-CH', 'device.SetHeaderHardwareAccept-CH' ] } }

Parameters
{Pipeline} - pipeline: The pipeline instance to get the properties from.
pipeline -
Returns
{object} Collection of headers which can be set in the response.

◆ getHeaderName()

SetHeadersElement::getHeaderName (   propertyName )
inline

Get the name of the header which the property relates to.

Parameters
{string} - propertyName: To get the header name from.
propertyName -
Returns
{string} Header name.

◆ getResponseHeaders()

SetHeadersElement::getResponseHeaders (   flowData )
inline

Get response headers (e.g.

Accept-CH)

Parameters
{FlowData} - flowData: A processed FlowData instance to get the response header values from.
flowData -
Returns
{object} A dictionary of response header names with their values if they are not null

◆ processInternal()

SetHeadersElement::processInternal (   flowData )
inline

Add the response header dictionary to the FlowData.

Parameters
{FlowData} - flowData the FlowData being processed

◆ tryGetValue()

SetHeadersElement::tryGetValue (   flowData,
  elementKey,
  propertyKey  
)
inline

Try to get the value for the given element and property.

If the value cannot be found or is null/unknown, then undefined is returned.

Parameters
{FlowData} - flowData: A processed FlowData instance to get the value from.
{string} - elementKey: Key for the element data to get the value from.
{string} - propertyKey: Name of the property to get the value for.
flowData -
elementKey -
propertyKey -
Returns
{string | undefined} value string or undefined.