Nantes Université
Skip to content
GitLab
Explorer
Connexion
S'inscrire
Navigation principale
Rechercher ou aller à…
Projet
E
evalassist-lib
Gestion
Activité
Membres
Labels
Programmation
Tickets
Tableaux des tickets
Jalons
Wiki
Code
Requêtes de fusion
Dépôt
Branches
Validations
Étiquettes
Graphe du dépôt
Comparer les révisions
Extraits de code
Compilation
Pipelines
Jobs
Planifications de pipeline
Artéfacts
Déploiement
Releases
Registre de paquets
Registre de conteneur
Registre de modèles
Opération
Environnements
Modules Terraform
Surveillance
Incidents
Service d'assistance
Analyse
Données d'analyse des chaînes de valeur
Analyse des contributeurs
Données d'analyse CI/CD
Données d'analyse du dépôt
Expériences du modèle
Aide
Aide
Support
Documentation de GitLab
Comparer les forfaits GitLab
Forum de la communauté
Contribuer à GitLab
Donner votre avis
Raccourcis clavier
?
Extraits de code
Groupes
Projets
Afficher davantage de fils d'Ariane
EvalAssist
evalassist-lib
Validations
4ec62ba4
Valider
4ec62ba4
rédigé
il y a 4 ans
par
Erwan BOUSSE
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
refactor!: remove default gitlab host, add error
parent
24477a5e
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Pipeline
#28450
réussi
il y a 4 ans
Étape: check
Modifications
1
Pipelines
1
Masquer les modifications d'espaces
En ligne
Côte à côte
Affichage de
1 fichier modifié
src/core/http-client/httpClient.axios.ts
+10
-1
10 ajouts, 1 suppression
src/core/http-client/httpClient.axios.ts
avec
10 ajouts
et
1 suppression
src/core/http-client/httpClient.axios.ts
+
10
−
1
Voir le fichier @
4ec62ba4
import
axios
,
{
AxiosInstance
}
from
'
axios
'
import
axios
,
{
AxiosInstance
}
from
'
axios
'
import
{
Problem
}
from
'
../exceptions
'
import
{
HTTPClient
,
HTTPClientConfig
,
HTTPResponse
,
RequestConfig
}
from
'
./httpClient.interface
'
import
{
HTTPClient
,
HTTPClientConfig
,
HTTPResponse
,
RequestConfig
}
from
'
./httpClient.interface
'
export
class
AxiosHTTPClient
implements
HTTPClient
{
export
class
AxiosHTTPClient
implements
HTTPClient
{
...
@@ -6,19 +7,27 @@ export class AxiosHTTPClient implements HTTPClient {
...
@@ -6,19 +7,27 @@ export class AxiosHTTPClient implements HTTPClient {
constructor
(
readonly
config
:
Partial
<
HTTPClientConfig
>
=
{})
{
constructor
(
readonly
config
:
Partial
<
HTTPClientConfig
>
=
{})
{
this
.
instance
=
axios
.
create
({
this
.
instance
=
axios
.
create
({
baseURL
:
(
config
.
host
||
'
https://gitlab.univ-nantes.fr
'
)
+
'
/api/v4
'
,
baseURL
:
config
.
host
+
'
/api/v4
'
,
headers
:
{
headers
:
{
Authorization
:
`Bearer
${
config
.
accessToken
}
`
,
Authorization
:
`Bearer
${
config
.
accessToken
}
`
,
},
},
})
})
}
}
private
checkConfiguration
()
{
if
(
!
this
.
config
.
host
)
{
throw
new
Problem
(
'
No configuration found. Please configure the Gitlab host to use.
'
)
}
}
async
get
<
T
>
(
path
:
string
,
config
?:
RequestConfig
):
Promise
<
HTTPResponse
<
T
>>
{
async
get
<
T
>
(
path
:
string
,
config
?:
RequestConfig
):
Promise
<
HTTPResponse
<
T
>>
{
this
.
checkConfiguration
()
const
{
data
,
headers
,
status
}
=
await
this
.
instance
.
get
(
path
,
config
||
{})
const
{
data
,
headers
,
status
}
=
await
this
.
instance
.
get
(
path
,
config
||
{})
return
{
data
,
headers
,
status
}
return
{
data
,
headers
,
status
}
}
}
async
post
<
T
>
(
path
:
string
,
config
?:
RequestConfig
):
Promise
<
HTTPResponse
<
T
>>
{
async
post
<
T
>
(
path
:
string
,
config
?:
RequestConfig
):
Promise
<
HTTPResponse
<
T
>>
{
this
.
checkConfiguration
()
const
{
data
,
headers
,
status
}
=
await
this
.
instance
.
post
(
path
,
config
?.
body
,
config
||
{})
const
{
data
,
headers
,
status
}
=
await
this
.
instance
.
post
(
path
,
config
?.
body
,
config
||
{})
return
{
data
,
headers
,
status
}
return
{
data
,
headers
,
status
}
}
}
...
...
This diff is collapsed.
Cliquez pour l'agrandir.
Aperçu
0%
Chargement en cours
Veuillez réessayer
ou
joindre un nouveau fichier
.
Annuler
You are about to add
0
people
to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Enregistrer le commentaire
Annuler
Veuillez vous
inscrire
ou vous
se connecter
pour commenter