![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@hapiness/http
Advanced tools
Http Module for the Hapiness framework, allowing user to deal with http request
Http
Module for the Hapiness framework, allowing user to deal with http
request.
yarn
or npm
it in your package.json
$ npm install --save @hapiness/http @hapiness/biim @hapiness/core rxjs
or
$ yarn add @hapiness/http @hapiness/biim @hapiness/core rxjs
"dependencies": {
"@hapiness/biim": "^1.4.0",
"@hapiness/core": "^1.3.0",
"@hapiness/http": "^1.1.2",
"rxjs": "^5.5.6",
//...
}
//...
HttpModule
import { HapinessModule } from '@hapiness/core';
import { HttpModule } from '@hapiness/http';
@HapinessModule({
version: '1.0.0',
declarations: [
LibWithHttpCalls
],
imports: [
HttpModule
]
})
class HapinessModuleNeedsHttpModule {}
You can use HttpService
anywhere in your module with dependency injection.
import { Lib } from '@hapiness/core';
import { HttpService } from '@hapiness/http';
@Lib()
class LibWithHttpCalls {
constructor(private _http: HttpService){}
crawlWebPage(): void {
this._http.get('http://www.google.fr').subscribe(
(data) => {
if (data.response.statusCode === 200) {
console.log(data.body); // Show the HTML for the Google homepage.
}
},
(err) => console.error(err) // Show error in console
);
}
}
Format your data with the Joi Schema validation and throw an error in the Observable if statusCode >= 400
validateResponse(<Joi.Schema>, [ignoredStatusCodes?])
import { Lib } from '@hapiness/core';
import { HttpService } from '@hapiness/http';
import '@hapiness/http/observable/add/validateResponse';
@Lib()
class LibWithHttpCalls {
constructor(private _http: HttpService){}
crawlWebPage(): void {
this._http.get('http://my-api/data')
.validateResponse(MySchema)
.subscribe(
(data) => console.log(data),
(err) => console.error(err) // Show error in console
);
}
}
This module is an encapsulation of Rx-Http-Request library to allow their features inside Hapiness framework.
Methods implemented are:
.request
.get(uri[, options])
.getBuffer(uri[, options])
.post(uri[, options])
.put(uri[, options])
.patch(uri[, options])
.delete(uri[, options])
.head(uri[, options])
.jar()
.cookie(str)
If you want to have all details for these methods, see Rx-Http-Request's API details.
To set up your development environment:
cd
to the main folder,npm or yarn install
,npm or yarn run test
.
./coverage/lcov-report/index.html
.core
versionJulien Fauville | Antoine Gomez | Sébastien Ritz | Nicolas Jessel |
Copyright (c) 2017 Hapiness Licensed under the MIT license.
FAQs
Http Module for the Hapiness framework, allowing user to deal with http request
We found that @hapiness/http demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.