13 Commits

Author SHA1 Message Date
b30f501bff backendsrv: Implement optional URL path fetch sanitize (#106540)
* feat: Implement optional URL path sanitization in BackendSrv methods

* add comment

* revert

* remove namespace import from backendsrv

* change method to validatePath, remove query params and fragments

* Moved validatePath call into fetch and make it throw an error instead

* update pluginSettings tests

* prettier

* Update public/app/features/plugins/pluginSettings.ts

Co-authored-by: Hugo Häggmark <hugo.haggmark@gmail.com>

* change name to validatePath

* fix other tests

* rename property in backend_srv tests

* rename to validatePath in backend_srv, add extra tests

* Move path validation into parseUrlFromOptions

* fix

* Add additional check

* Add test

---------

Co-authored-by: joshhunt <josh.hunt@grafana.com>
Co-authored-by: Hugo Häggmark <hugo.haggmark@gmail.com>
2025-06-20 11:27:53 +01:00
ec857e1de9 Loki: Add dashboard and panel names as headers (#92096)
* feat(nameHeaders): add feature flag

* add safe parsing of headers

* use headers in loki datasource

* Loki: add option to pass headers to Loki

* Loki: add datasource tests for dashboard names

* cleanup

* DataSourceWithBackend: add test

* rename to `sanitizeHeader`

* Loki: add condition when to add headers

* Loki: add e2e tests

* Loki: change test name
2024-08-22 21:30:43 +02:00
7cc925d319 Query Library: Enable edit description (#90009)
* WIP

* Finish getting form to populate

* WIP API

* Get PUT to work although the edit doesnt apply yet

* Complete working PUT

* PATCH v1 no json patch

* This works!

* Fix headers to be configurable

* Fix translations

* Revert "This works!"

This reverts commit d57ffcbc4bcf4fdaa414739838ce2377ca65a480.

# Conflicts:
#	public/app/features/query-library/api/factory.ts
#	public/app/features/query-library/api/query.ts
#	public/app/features/query-library/types.ts

* Use normal method of patching 😅

* Replace add to library form with generic version

* make translations generic

* Rename function, fix bad conflict resolution
2024-08-14 10:11:53 -05:00
a5c75c5ffb Remove explicit imports of whatwg-fetch from individual test files 2024-04-18 12:23:38 +01:00
5c1e8c108a Allow to pass a blob to core fetch function (#71929)
* Allow to pass a blob to core fetch function

* Use global blob instead of import

---------

Co-authored-by: Andrej Ocenas <mr.ocenas@gmail.com>
2023-07-24 17:02:56 +02:00
f8d89eff56 Chore: fix type errors in tests (#63270)
* fix any's in tests

* fix more any's in tests

* more test type fixes

* fixing any's in tests part 3

* more test type fixes

* fixing test any's p5

* some tidy up

* fix template_srv
2023-02-14 16:46:42 +01:00
84b7efb393 fix: only "swallow" the json() parsing error if the response is empty (#47493) 2022-05-26 13:01:53 +02:00
c25031fa49 Chore: Remove console.log in fetch.test.ts (#45134) 2022-02-09 14:11:30 +01:00
d87cd6f26c Update dependency prettier to v2.5.1 (#43473)
* Update dependency prettier to v2.5.1

* prettier fixes

* chore(toolkit): bump prettier to 2.5.1

* style(eslint): bump grafana config to 2.5.2 in core and toolkit

* style(mssql-datasource): fix no-inferrable-types eslint errors

Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: Ashley Harrison <ashley.harrison@grafana.com>
Co-authored-by: Jack Westbrook <jack.westbrook@gmail.com>
2022-02-02 12:02:32 +00:00
d85d547ab3 BackendSrv: support binary responseType like $http did (#29004) 2020-11-18 09:35:28 -08:00
72c3257d19 BackendSrv: Uses credentials and defaults to same-origin (#27385)
Co-authored-by: Liu Yang yangliuyu@163.com
2020-09-04 22:11:34 +02:00
afd8ffde69 BackendSrv: include credentials when withCredentials option is set (#23380)
The fetch() API won't send cookies or other type of credentials unless
you set the credentials init option. Some datasources like Prometheus
and Elasticsearch have `withCredentials` option in Browser access mode,
but this option is not currently getting passed in the fetch() API.

Fixes #23338.
2020-04-07 16:09:02 +02:00
8d5c6053db BackendSrv: only add content-type on POST, PUT requests (#22910)
* BackendSrv: only add content-type on POST, PUT requests
Fixes #22869

* Tests: imports polyfill for Headers
2020-03-20 10:21:32 +01:00