Socket
Socket
Sign inDemoInstall

syshub-rest-module

Package Overview
Dependencies
Maintainers
1
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

syshub-rest-module - npm Package Compare versions

Comparing version 5.0.1 to 5.0.2

2

package.json
{
"name": "syshub-rest-module",
"version": "5.0.1",
"version": "5.0.2",
"description": "This package provides a generic library for the communication from an Angular SPA with a NT-Ware uniFLOW sysHUB backend server based on HTTPS Rest API with OAuth2 flow.",

@@ -5,0 +5,0 @@ "keywords": [

@@ -24,3 +24,3 @@ [![Node.js CI](https://github.com/surcoufx83/syshub-rest-module/actions/workflows/node.js.yml/badge.svg)](https://github.com/surcoufx83/syshub-rest-module/actions/workflows/node.js.yml)

| :-------------- | :------------------------- | :---------------------------- |
| 17.x | 4.x (or 3.x) | `npm i syshub-rest-module@^4` |
| 17.x | 5.x (4.x to 3.x) | `npm i syshub-rest-module@^5` |
| 16.x | 2.x | `npm i syshub-rest-module@^2` |

@@ -240,3 +240,3 @@

```ts
this.restService.get('currentUser').subscribe((response) => {
this.restService.get('currentUser', undefined, true).subscribe((response) => {
if (response.status == HttpStatusCode.Ok) {

@@ -321,2 +321,4 @@ // Ok response

// Handle failed response
} else if (response === HttpStatusCode.NotModified) {
// Entity not changed
} else {

@@ -329,2 +331,24 @@ // Handle successful response

### Using sysHUB Server cache
From version 5 of this module, the Etag mechanism, which is also available in the sysHUB Rest API, is taken into account. Basically, this works in such a way that the server delivers an Etag (a hash value) with every response. If the same resource is requested again and the hash value is supplied, the server checks whether the resource has changed. If so, it delivers the resource plus the new Etag as normal. If not, the server returns the HTTP status code 304/Not modified.
The Rest module has now also implemented the corresponding functionality and enables the use of the Etag feature for all GET requests that do not concern custom endpoints. The feature is activated by default and means that in future, in addition to the response from the server or an error, the code 304 can also be returned to the calling function. In this case, the requested resource has not changed and there is no new data.
In order to skip the etag check and force the server to deliver the resource again, set the param `clean` to `true`:
```ts
this.restService.getCurrentUser(true).subscribe((response) => {
if (response instanceof Error) {
// Handle failed response
} else if (response === HttpStatusCode.NotModified) {
// Entity not changed
// Will not happen due to param clean=true
} else {
// Handle successful response
// Guaranteed to be a SyshubUserAccount typed object, not an Error.
}
});
```
## Credits

@@ -331,0 +355,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc