mirror of
https://github.com/strapi/strapi.git
synced 2025-07-04 07:27:23 +00:00

* Fix formatFileInfo Keep original file name including extension * Fix file name for generated media File name was not set for all generated media: thumbnail and resized pictures. * Generate hash based on file name without extension * cleanup PR Signed-off-by: Alexandre Bodin <bodin.alex@gmail.com> * Fix unit tests Exclude temporarily unit test 'Replaces reserved and unsafe characters for URLs and files in hash' because it did not work properly ever. * Remove path delimiter from filename because it is correct character for file path * Fix e2e * Continue fixes for e2e * Fix createRequest content type * Correct thumbnail name in e2e test Co-authored-by: Alexandre BODIN <alexandrebodin@users.noreply.github.com> Co-authored-by: Alexandre Bodin <bodin.alex@gmail.com> Co-authored-by: Andrey Hohutkin <none@none>
26 lines
494 B
JavaScript
26 lines
494 B
JavaScript
const request = require('request-promise-native');
|
|
|
|
const createRequest = (defaults = {}) => {
|
|
return request.defaults({
|
|
baseUrl: 'http://localhost:1337',
|
|
json: true,
|
|
resolveWithFullResponse: true,
|
|
simple: false,
|
|
...defaults,
|
|
});
|
|
};
|
|
|
|
const createAuthRequest = token => {
|
|
return createRequest({
|
|
headers: {
|
|
Authorization: `Bearer ${token}`,
|
|
'Content-Type': 'application/json',
|
|
},
|
|
});
|
|
};
|
|
|
|
module.exports = {
|
|
createRequest,
|
|
createAuthRequest,
|
|
};
|