mirror of
https://github.com/Kong/insomnia
synced 2024-11-07 22:30:15 +00:00
add missing text xpath type handler (#4083)
This commit is contained in:
parent
e793e6f166
commit
d23fae5b6f
@ -26,6 +26,13 @@ describe('query()', () => {
|
||||
]);
|
||||
});
|
||||
|
||||
it('handles text() query', () => {
|
||||
expect(query('<book><title>Harry</title><title>Potter</title></book>', 'local-name(/book)'))
|
||||
.toEqual([{ 'inner': 'book', 'outer': 'book' }]);
|
||||
expect(query('<book><title>Harry</title><title>Potter</title></book>', '//title/text()'))
|
||||
.toEqual([{ 'inner': 'Harry', 'outer': 'Harry' }, { 'inner': 'Potter', 'outer': 'Potter' }]);
|
||||
});
|
||||
|
||||
it('handles invalid query', () => {
|
||||
expect(() => {
|
||||
query('<hi>there</hi>', '//[]');
|
||||
|
@ -43,6 +43,13 @@ export const query = (xml: string, query?: string) => {
|
||||
});
|
||||
break;
|
||||
|
||||
case 'Text':
|
||||
output.push({
|
||||
outer: (selectedValue as Text).toString().trim(),
|
||||
inner: (selectedValue as Text).toString().trim(),
|
||||
});
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user