Skip to content

[Livraison-1.1.0] Cancel request and errors api #149

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 52 commits into from
Apr 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
c2c1e6a
Test + ajout des locks a commencé
Lunotte Jan 22, 2022
9b37383
TU
Lunotte Jan 23, 2022
909795b
Update dependencies (non-major)
renovate-bot Mar 1, 2022
a45cb63
Annuler la requête en cours et en declencher une nouvelle
Lunotte Mar 1, 2022
f08743c
TU Directory service et début test du cancel token
Lunotte Mar 19, 2022
415a1e8
Passage des TU
Lunotte Mar 19, 2022
43bfd18
Test fonctionnel en cours
Lunotte Mar 20, 2022
aa37aaf
Tests fonctionnels ok
Lunotte Mar 21, 2022
d46c2f4
Renommage addToDirectory to lock
Lunotte Mar 21, 2022
058c408
Ménage
Lunotte Mar 22, 2022
b0944ea
Toutes petite modification.
Lunotte Mar 22, 2022
2f7b7d8
Mise à disposition du service pour obtenir la liste des requêtes en e…
Lunotte Mar 30, 2022
9453284
Merge branch 'cancel-request' of https://github.com/Lunotte/react-htt…
LunotteCap Mar 31, 2022
b79c86e
Monter de version de axios
Lunotte Apr 1, 2022
38ace8c
Modificatiion du changelog
Lunotte Apr 11, 2022
afd2581
Mise à jour de la documentation
Lunotte Apr 17, 2022
a9caa7d
Afficher un message d’erreur si on ne retrouve pas la configuration a…
Lunotte Apr 18, 2022
496a73a
mise à jour des versions
LunotteCap Apr 19, 2022
168dff7
maj package.json
Lunotte Apr 25, 2022
01e90f2
Test buil android version in ci
Lunotte Apr 25, 2022
0cb703f
Update package.json
Lunotte Apr 25, 2022
c8635f5
Update package.json
Lunotte Apr 25, 2022
a517699
Mise à jour package.json
Lunotte Apr 25, 2022
b416c02
Update build.yml
Lunotte Apr 25, 2022
b598dd0
Update package.json
Lunotte Apr 25, 2022
73d2cab
Test avec nouvelle configuration
Lunotte Apr 25, 2022
7beb718
Test avec nouvelle configuration
Lunotte Apr 25, 2022
67baa6d
Merge branch 'cancel-request' of https://github.com/Lunotte/react-htt…
Lunotte Apr 25, 2022
6e201d1
Update package.json
Lunotte Apr 26, 2022
fb7a964
Update package.json
Lunotte Apr 26, 2022
70c72da
Update package.json
Lunotte Apr 26, 2022
b884a3f
Update package.json
Lunotte Apr 26, 2022
dedff11
Update build.yml
Lunotte Apr 26, 2022
36d61ad
Update build.yml
Lunotte Apr 26, 2022
ad3f00b
Update Rh2EffectsService.spec.ts
Lunotte Apr 26, 2022
cd0045d
Update Rh2EffectsService.spec.ts
Lunotte Apr 26, 2022
825ac47
Update build.yml
Lunotte Apr 26, 2022
a1b30f3
Update build.yml
Lunotte Apr 26, 2022
8dc6fd7
Update build.yml
Lunotte Apr 26, 2022
987c377
Update build.yml
Lunotte Apr 26, 2022
f9e9394
Update build.yml
Lunotte Apr 26, 2022
476a4ca
Update build.yml
Lunotte Apr 26, 2022
dd0609f
Update build.yml
Lunotte Apr 26, 2022
ad09dbf
Update build.yml
Lunotte Apr 26, 2022
787b4c9
Update build.yml
Lunotte Apr 27, 2022
87204ed
Update build.yml
Lunotte Apr 27, 2022
399a337
Update CHANGELOG.md
Lunotte Apr 27, 2022
c8db042
Merge branch 'master' into cancel-request
Lunotte Apr 27, 2022
cb04fa7
Update .travis.yml
Lunotte Apr 27, 2022
e9b4188
Update .travis.yml
Lunotte Apr 27, 2022
e38a030
Update .travis.yml
Lunotte Apr 27, 2022
383f01f
modification de la version de @types/lodash et vérification du build …
LunotteCap Apr 28, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: react-native-android-build-apk
on:
workflow_dispatch:
push:
branches:
- cancel-request
jobs:
install-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install npm dependencies
run: |
npm install --legacy-peer-deps && npm test
build-android:
needs: install-and-test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install npm dependencies
run: |
npm install --legacy-peer-deps
- name: Change wrapper permissions
run: chmod +x ./android/gradlew
- name: Build Android Release
run: |
cd android && ./gradlew assembleRelease
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: app-release.apk
path: android/app/build/outputs/apk/release/
# build-ios:
# needs: install-and-test
# runs-on: macos-latest
# steps:
# - uses: actions/checkout@v3
# - name: Install npm dependencies
# run: |
# npm install --legacy-peer-deps
# - run: xcode-select -p
# - run: pod install
# working-directory: ios
# name: Install pod dependencies
# - name: Build iOS (debug)
# run: xcodebuild \
# -workspace ios/ReactHttpRequestHandler.xcworkspace \
# -scheme ReactHttpRequestHandler \
# clean archive \
# -sdk iphoneos \
# -configuration Debug \
# -UseModernBuildSystem=NO \
# -archivePath $PWD/ReactHttpRequestHandler \
# CODE_SIGNING_ALLOWED=NO

4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ branches:
- master
language: node_js
node_js:
- stable
- 17
addons:
sonarcloud:
organization: lunotte
Expand All @@ -12,6 +12,8 @@ addons:
cache:
directories:
- node_modules
install:
- npm install --legacy-peer-deps
script:
- npm test -- --coverage
- sonar-scanner
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,5 +100,6 @@
"language": "typescript",
"mapTo": "javascript"
}
]
],
"typescript.enablePromptUseWorkspaceTsdk": false
}
11 changes: 9 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
# Changelog

## [Unreleased]
Cancel http request. This functionality is available using the available axios instance as described in the axios instance section of the table of contents.
## [1.1.0] - 2022-04-27

### Added
Get API history in errors
Cancel http request

### Updated
Upgrade Axios
Rename addToDirectory to lock

## [1.0.3] - 2022-01-15

Expand Down
4 changes: 2 additions & 2 deletions __tests__/services/Rh2AxiosConfigService.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ const GOOGLE = 'GOOGLE';
const MICROSOFT = 'MICROSOFT';

const axiosConfig: AxiosRequestConfig = { url: 'https://www.google.com', method: 'GET' };
const configACharger: Rh2AxiosConfig = { axiosRequestConfig: axiosConfig, label: GOOGLE, addToDirectory: true };
const configACharger: Rh2AxiosConfig = { axiosRequestConfig: axiosConfig, label: GOOGLE, lock: true };

const axiosConfig2: AxiosRequestConfig = { url: 'https://www.microsoft.com', method: 'GET' };
const configACharger2: Rh2AxiosConfig = { axiosRequestConfig: axiosConfig2, label: MICROSOFT, addToDirectory: false};
const configACharger2: Rh2AxiosConfig = { axiosRequestConfig: axiosConfig2, label: MICROSOFT, lock: false};

describe('Remove Configuration', () => {
it('Supprime les éléments configurés', () => {
Expand Down
68 changes: 5 additions & 63 deletions __tests__/services/Rh2AxiosInstanceService.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Created Date: Su Aug yyyy *
* Author: <<author> *
* ----- *
* Last Modified: Sun Aug 08 2021 *
* Last Modified: 2022 02 12 - 04:37 pm *
* Modified By: Charly Beaugrand *
* ----- *
* Copyright (c) 2021 Lunotte *
Expand Down Expand Up @@ -159,66 +159,8 @@ describe('Init Axios instance', () => {
ejectInterceptor(resultat);
});

// it('List Axios request with key and request', () => {

// const key = 'TEST_VALUE';
// const axiosRequestConfig: AxiosRequestConfig = {
// baseURL: 'http://test.fr'
// };
// const axiosRequestConfigExtended: AxiosRequestConfigExtended = {
// key,
// axiosConfig: axiosRequestConfig,
// defaultInterceptor: false
// };

// initAxiosInstance([
// axiosRequestConfigExtended
// ]);
// expect(Object.keys(rh2ConfigService.getAxiosInstances())).toEqual([
// key
// ]);

// console.log(rh2ConfigService.getAxiosInstances());
// });

// it('List Axios request with key and request - 2 elements', () => {

// const key = 'TEST_VALUE';
// const axiosRequestConfig: AxiosRequestConfig = {
// baseURL: 'http://test.fr'
// };
// const axiosRequestConfigExtended: AxiosRequestConfigExtended = {
// key,
// axiosConfig: axiosRequestConfig
// };

// const key2 = 'TEST_VALUE_2';
// const axiosRequestConfig2: AxiosRequestConfig = {
// baseURL: 'http://test2.fr'
// };
// const axiosRequestConfigExtended2: AxiosRequestConfigExtended = {
// key: key2,
// axiosConfig: axiosRequestConfig2
// };

// initAxiosInstance([
// axiosRequestConfigExtended,
// axiosRequestConfigExtended2
// ]);
// expect(Object.keys(rh2ConfigService.getAxiosInstances())).toEqual([
// key,
// key2
// ]);
// const axiosInstance1 = Object.values(rh2ConfigService.getAxiosInstances())[0];
// const axiosInstance2 = Object.values(rh2ConfigService.getAxiosInstances())[1];
// expect(axiosInstance1.axiosInstance.defaults.baseURL).toEqual(axiosRequestConfig.baseURL);
// expect(axiosInstance2.axiosInstance.defaults.baseURL).toEqual(axiosRequestConfig2.baseURL);

// console.log(rh2ConfigService.getAxiosInstances());
// });
});


describe('Generate a header to interceptor', () => {
const HEARDER_PAR_DEFAUT = {
"Content-Type": "application/json"
Expand Down Expand Up @@ -254,7 +196,7 @@ describe('Generate a header to interceptor', () => {
const test: any = 'sdfsdf';

const resultat = await generateHeaders(axiosConfig, [
test as KeyValue
test as KeyValue<string>
]);

expect(resultat.headers[0]).toBeFalsy();
Expand All @@ -267,7 +209,7 @@ describe('Generate a header to interceptor', () => {
};
expect(axiosConfig.headers).toBeFalsy();

const test: KeyValue = {
const test: KeyValue<string> = {
key: 'Content-Type',
value: 'application/json'
};
Expand All @@ -294,7 +236,7 @@ describe('Generate a header to interceptor', () => {

it('Header param 1', async () => {

const unHeader: KeyValue[] = [
const unHeader: KeyValue<string>[] = [
{
key: 'key-test',
value: 'Test a value'
Expand All @@ -312,7 +254,7 @@ describe('Generate a header to interceptor', () => {

it('Header param 2', async () => {

const unHeader: KeyValue[] = [
const unHeader: KeyValue<string>[] = [
{
key: 'key-test',
value: 'Test a value'
Expand Down
Loading