mirror of
https://github.com/usebruno/bruno.git
synced 2025-06-25 14:31:44 +02:00
fix/collection-search-validations unit-tests-fix (#2833)
* fix: updates * fix: update test title * fix: removed console
This commit is contained in:
parent
22c096507d
commit
eceb114d6c
@ -3,7 +3,7 @@ import filter from 'lodash/filter';
|
|||||||
import find from 'lodash/find';
|
import find from 'lodash/find';
|
||||||
|
|
||||||
export const doesRequestMatchSearchText = (request, searchText = '') => {
|
export const doesRequestMatchSearchText = (request, searchText = '') => {
|
||||||
return request.name.toLowerCase().includes(searchText.toLowerCase());
|
return request?.name?.toLowerCase().includes(searchText.toLowerCase());
|
||||||
};
|
};
|
||||||
|
|
||||||
export const doesFolderHaveItemsMatchSearchText = (item, searchText = '') => {
|
export const doesFolderHaveItemsMatchSearchText = (item, searchText = '') => {
|
||||||
|
@ -123,7 +123,8 @@ const curlToJson = (curlCommand) => {
|
|||||||
request.urlWithoutQuery = 'http://' + request.urlWithoutQuery;
|
request.urlWithoutQuery = 'http://' + request.urlWithoutQuery;
|
||||||
}
|
}
|
||||||
|
|
||||||
requestJson.url = request.urlWithoutQuery
|
requestJson.url = request.urlWithoutQuery;
|
||||||
|
requestJson.raw_url = request.url;
|
||||||
requestJson.method = request.method;
|
requestJson.method = request.method;
|
||||||
|
|
||||||
if (request.cookies) {
|
if (request.cookies) {
|
||||||
|
@ -75,4 +75,15 @@ describe('curlToJson', () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should return and parse a simple curl command with a trailing slash', () => {
|
||||||
|
const curlCommand = 'curl https://www.usebruno.com/';
|
||||||
|
const result = curlToJson(curlCommand);
|
||||||
|
|
||||||
|
expect(result).toEqual({
|
||||||
|
url: 'https://www.usebruno.com/',
|
||||||
|
raw_url: 'https://www.usebruno.com/',
|
||||||
|
method: 'get'
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@ -187,10 +187,21 @@ const parseCurlCommand = (curlCommand) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
urlObject.search = null; // Clean out the search/query portion.
|
urlObject.search = null; // Clean out the search/query portion.
|
||||||
|
|
||||||
|
let urlWithoutQuery = URL.format(urlObject);
|
||||||
|
let urlHost = urlObject?.host;
|
||||||
|
if (!url?.includes(`${urlHost}/`)) {
|
||||||
|
if (urlWithoutQuery && urlHost) {
|
||||||
|
const [beforeHost, afterHost] = urlWithoutQuery.split(urlHost);
|
||||||
|
urlWithoutQuery = beforeHost + urlHost + afterHost?.slice(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const request = {
|
const request = {
|
||||||
url: url,
|
url,
|
||||||
urlWithoutQuery: URL.format(urlObject)
|
urlWithoutQuery
|
||||||
};
|
};
|
||||||
|
|
||||||
if (compressed) {
|
if (compressed) {
|
||||||
request.compressed = true;
|
request.compressed = true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user