@som30ind/mobile-http
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

Mobile HTTP Module for Angular

This module will help to switch between Cordova & XHR. For now this module is created to work with @angular/http.

Build Status

Usage

Below variable need to switch to true / false to toggle use between Cordova & XHR usage.

Installation

npm install @som30ind/mobile-http

To switch to use Browser XHR

var isMobile = false;

To switch to use Cordova HTTP

var isMobile = true;

Angular Integration

Just use MobileHttpModule in your module files. Rest of the application (Components / Services) will continue using Http from @angular/http.

import { MobileHttpModule } from '@som30ind/mobile-http';

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

Browser support

This plugin supports a very restricted set of functions on the browser platform. It's meant for testing purposes, not for production grade usage.

Following features are not supported with Cordova as cordova-plugin-advanced-http does not support it:

  • Manipulating Cookies
  • Uploading and Downloading files
  • Pinning SSL certificate
  • Disabling SSL certificate check
  • Disabling transparently following redirects (HTTP codes 3xx)
  • Circumventing CORS restrictions

Libraries

This plugin utilizes some awesome open source libraries:

For Cordova interaction,

License

Copyright (c) 2020 Somnath Sinha

Package Sidebar

Install

npm i @som30ind/mobile-http

Weekly Downloads

0

Version

1.0.3

License

MIT

Unpacked Size

227 kB

Total Files

36

Last publish

Collaborators

  • som30ind