Move /e2e -> /e2e-tests
Этот коммит содержится в:
36
e2e-tests/cypress/tests/plugins/client_request.js
Обычный файл
36
e2e-tests/cypress/tests/plugins/client_request.js
Обычный файл
@@ -0,0 +1,36 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
const axios = require('axios');
|
||||
|
||||
module.exports = async ({data = {}, headers, method = 'get', url}) => {
|
||||
let response;
|
||||
|
||||
try {
|
||||
response = await axios({
|
||||
data,
|
||||
headers,
|
||||
method,
|
||||
url,
|
||||
});
|
||||
} catch (error) {
|
||||
// If we have a response for the error, pull out the relevant parts
|
||||
if (error.response) {
|
||||
response = {
|
||||
status: error.response.status,
|
||||
statusText: error.response.statusText,
|
||||
data: error.response.data,
|
||||
};
|
||||
} else {
|
||||
// If we get here something else went wrong, so throw
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
data: response.data,
|
||||
headers: response.headers,
|
||||
status: response.status,
|
||||
statusText: response.statusText,
|
||||
};
|
||||
};
|
||||
Ссылка в новой задаче
Block a user