npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@kimaya/ngx-http-service

v1.0.11

Published

This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 8.1.0.

Readme

HttpHandler

This project was generated with Angular CLI version 8.1.0.

How Install

npm install @kimaya/ngx-http-service

Dependency

You need to install dependencies manually

CookieStorage this is being used to store all cookies in this library. AuthService this is being used for checking and fetching auth related settings.

Plug into your application

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
import { HttpServiceModule } from 'ngx-http-service';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    HttpServiceModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

How to use

Inject into your Component or Service.

    import { Component } from '@angular/core';
    import { HttpService } from 'ngx-http-service';
    
    @Component({
      selector: 'app-root',
      templateUrl: './app.component.html',
      styleUrls: ['./app.component.scss']
    })
    
    export class AppComponent {
      constructor(private httpService: HttpService) {
      }
    }
    

HttpService Configure

User can configure some of keys for auth service as per project requirements.

User need to set HttpServiceConstants keys for usages.

Need to set serverUrl .This will be used to hit api using httpService used as host for all default api

ServerUrl is host

| Keys | Required | Default Value| Usage| |-------------|-------------|-----|-----| | serverUrl | true | null | used to store default host for all api end point which passed to HttpService functions | | headers | false | {} | Provide extra headers for all Http request including multipart request |

Methods

get(endPoint: string, params?: object, body?: object, contentType?: string, backendUrl?: string ): Observable;

    this.httpService.get(endPoint).subscribe();

to call http get method. In this method service will automatically append serverUrl from constant (host) and endPoint parameter.

  • endPoint: http api end point without host
  • params: to set in param header [optional]
  • body: to set in body header [optional]
  • contentType: to set in content type header [optional]
  • backendUrl: if you want to change host pass this parament [optional]

getFromUrl(url: string, params?: object, body?: object, contentType?: string): Observable;

    this.httpService.getFromUrl(endPoint).subscribe();

to call http get method. In this method service will not append serverUrl from constant (host) and will hit api based url you pass.

  • url: http api url with host and end point
  • params: to set in param header [optional]
  • body: to set in body header [optional]
  • contentType: to set in content type header [optional]

getFromUrlWithoutHeader(url: string): Observable;

    this.httpService.getFromUrlWithoutHeader(url).subscribe();

to call http get method. In this method, service will not add default header setting for http call.

  • url: http api url with host and end point
  • headers: HttpHeader- Custom Headers can be added.

post(endPoint: string, requestBody: object, params?: object, body?: object, contentType?: string, backendUrl?: string ): Observable;

    this.httpService.post(endPoint, requestBody).subscribe();

to call http post method. In this method service will automatically append serverUrl from constant (host) and endPoint parameter.

  • endPoint: http api end point without host
  • requestBody: request body in json
  • params: to set in param header [optional]
  • body: to set in body header [optional]
  • contentType: to set in content type header [optional]
  • backendUrl: if you want to change host pass this parameter [optional]

postFromUrl(url: string, requestBody: object, params?: object, body?: object, contentType?: string): Observable;

    this.httpService.postFromUrl(url, requestBody).subscribe();

to call http post method. In this method service will not append serverUrl from constant (host) and will hit api based url you pass.

  • url: http api url with host and end point
  • requestBody: request body in json
  • params: to set in param header [optional]
  • body: to set in body header [optional]
  • contentType: to set in content type header [optional]

postFromUrlWithoutHeader(url: string, requestBody: object): Observable;

    this.httpService.postFromUrlWithoutHeader(url, requestBody).subscribe();

to call http post method. In this method, service will not add default header setting for http call.

  • url: http api url with host and end point
  • requestBody: request body in json
  • headers: HttpHeader- Custom Headers can be added.

put(endPoint: string, requestBody: object, params?: object, body?: object, contentType?: string, backendUrl?: string ): Observable;

    this.httpService.put(endPoint, requestBody).subscribe();

to call http put method. In this method service will automatically append serverUrl from constant (host) and endPoint parameter.

  • endPoint: http api end point without host
  • requestBody: request body in json
  • params: to set in param header [optional]
  • body: to set in body header [optional]
  • contentType: to set in content type header [optional]
  • backendUrl: if you want to change host pass this parameter [optional]

putFromUrl(url: string, requestBody: object, params?: object, body?: object, contentType?: string): Observable;

    this.httpService.putFromUrl(url, requestBody).subscribe();

to call http put method. In this method service will not append serverUrl from constant (host) and will hit api based url you pass.

  • url: http api url with host and end point
  • requestBody: request body in json
  • params: to set in param header [optional]
  • body: to set in body header [optional]
  • contentType: to set in content type header [optional]

putFromUrlWithoutHeader(url: string, requestBody: object): Observable;

    this.httpService.putFromUrlWithoutHeader(url, requestBody).subscribe();

to call http put method. In this method, service will not add default header setting for http call.

  • url: http api url with host and end point
  • requestBody: request body in json
  • headers: HttpHeader- Custom Headers can be added.

delete(endPoint: string, params?: object, body?: object, contentType?: string, backendUrl?: string ): Observable;

    this.httpService.delete(endPoint).subscribe();

to call http delete method. In this method service will automatically append serverUrl from constant (host) and endPoint parameter.

  • endPoint: http api end point without host
  • params: to set in param header [optional]
  • body: to set in body header [optional]
  • contentType: to set in content type header [optional]
  • backendUrl: if you want to change host pass this parameter [optional]

deleteFromUrl(url: string, params?: object, body?: object, contentType?: string): Observable;

    this.httpService.deleteFromUrl(endPoint).subscribe();

to call http delete method. In this method service will not append serverUrl from constant (host) and will hit api based url you pass.

  • url: http api url with host and end point
  • params: to set in param header [optional]
  • body: to set in body header [optional]
  • contentType: to set in content type header [optional]

deleteFromUrlWithoutHeader(url: string): Observable;

    this.httpService.deleteFromUrlWithoutHeader(url).subscribe();

to call http delete method. In this method, service will not add default header setting for http call.

  • url: http api url with host and end point
  • headers: HttpHeader- Custom Headers can be added.

multipart(endPoint: string, formData: FormData, methodType: HttpMethodTypes = HttpMethodTypes.GET, backendUrl?: string, responseType: HttpResponseTypes = HttpResponseTypes.json, authKey: string = 'Authorization'): Observable;

    this.httpService.multipart(endPoint, formData).subscribe();

to call http method for multipart. In this method service will automatically append serverUrl from constant (host) and endPoint parameter.

  • endPoint: string
  • formData: FormData
  • methodType: HttpMethodTypes = HttpMethodTypes.GET // default get method
  • backendUrl: string [optional]
  • responseType: HttpResponseTypes = HttpResponseTypes.json // default JSON type
  • httpHeaders: HttpHeader = null // default null
  • authKey: string = 'Authorization'

multipartFromUrl(url: string, formData: FormData, methodType: HttpMethodTypes = HttpMethodTypes.GET, backendUrl: string, responseType: HttpResponseTypes = HttpResponseTypes.json, authKey: string = 'Authorization'): Observable;

    this.httpService.multipartFromUrl(endPoint, formData).subscribe();

to call http method for multipart. In this method, service will not add default header setting for http call.

  • url: string
  • formData: FormData
  • methodType: HttpMethodTypes = HttpMethodTypes.GET // default get method
  • responseType: HttpResponseTypes = HttpResponseTypes.json // default JSON type
  • httpHeaders: HttpHeader = null // default null
  • authKey: string = 'Authorization'

Enums

We can use this enum values to pass parameters for multipart methods.

HttpResponseTypes

enum HttpResponseTypes {
  'blob' = 'blob',
  'json' = 'json',
  'arraybuffer' = 'arraybuffer'
}

HttpMethodTypes

enum HttpMethodTypes {
  'GET' = 'GET',
  'POST' = 'POST',
  'PUT' = 'PUT'
}  

For more Information

you can contact on [email protected]