File

src/app/shared/support/http.utils.ts

Description

Contains common HTTP-related helper methods.

Example

Index

Methods

Methods

Public getDefaultHttpHeaders
getDefaultHttpHeaders()
Returns : any
Public getPaginationParams
getPaginationParams(page: number, size: number)
Parameters :
Name Type Optional Description
page number
size number
Returns : HttpParams
import { HttpHeaders, HttpParams } from '@angular/common/http';

/**
 * Contains common HTTP-related helper methods.
 *
 * @author Gunnar Hillert
 */
export class HttpUtils {

  public static getDefaultHttpHeaders() {
    const headers = new HttpHeaders({
      'Content-Type': 'application/json',
      'Accept': 'application/json'
    });
    return headers;
  }

  public static getPaginationParams(page: number, size: number): HttpParams {
    const params = new HttpParams()
      .append('page', page.toString())
      .append('size', size.toString());

    return params;
  }
}

results matching ""

    No results matching ""