Options
All
  • Public
  • Public/Protected
  • All
Menu

Class HttpRequestDetector

Helper class that retrieves parameters from HTTP requests.

Hierarchy

  • HttpRequestDetector

Index

Methods

Static detectAddress

  • detectAddress(req: any): string
  • Detects the IP address from which the given HTTP request was received.

    Parameters

    • req: any

      an HTTP request to process.

    Returns string

    the detected IP address (without a port). If no IP is detected - null will be returned.

Static detectBrowser

  • detectBrowser(req: any): string
  • Detects the browser (using "user-agent") from which the given HTTP request was made.

    Parameters

    • req: any

      an HTTP request to process.

    Returns string

    the detected browser. Detectable browsers: "chrome", "msie", "firefox", "safari". Otherwise - "unknown" will be returned.

Static detectPlatform

  • detectPlatform(req: any): string
  • Detects the platform (using "user-agent") from which the given HTTP request was made.

    Parameters

    • req: any

      an HTTP request to process.

    Returns string

    the detected platform and version. Detectable platforms: "mobile", "iphone", "ipad", "macosx", "android", "webos", "mac", "windows". Otherwise - "unknown" will be returned.

Static detectServerHost

  • detectServerHost(req: any): string
  • Detects the host name of the request's destination server.

    Parameters

    • req: any

      an HTTP request to process.

    Returns string

    the destination server's host name.

Static detectServerPort

  • detectServerPort(req: any): any
  • Detects the request's destination port number.

    Parameters

    • req: any

      an HTTP request to process.

    Returns any

    the detected port number or 80 (if none are detected).

Generated using TypeDoc