Skip to content

Commit 3f86786

Browse files
authored
Merge pull request #456 from danieldotnl/put_support
Add support for PUT and validate method in schema case insensitive
2 parents ab2fcc7 + 4c96b38 commit 3f86786

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

custom_components/multiscrape/const.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848

4949
SCRAPER_DATA = "scraper"
5050

51-
METHODS = ["POST", "GET", "post", "get"]
51+
METHODS = ["POST", "GET", "PUT"]
5252
DEFAULT_SEPARATOR = ","
5353

5454
LOG_ERROR = "error"

custom_components/multiscrape/schema.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,11 @@
5050
),
5151
vol.Optional(CONF_HEADERS): vol.Schema({cv.string: cv.template}),
5252
vol.Optional(CONF_PARAMS): vol.Schema({cv.string: cv.template}),
53-
vol.Optional(CONF_METHOD, default=DEFAULT_METHOD): vol.In(METHODS),
53+
vol.Optional(CONF_METHOD, default=DEFAULT_METHOD): vol.All(
54+
cv.string, # Ensure it's a string
55+
lambda method: method.lower(), # Convert to lowercase
56+
vol.In([m.lower() for m in METHODS]) # Validate against lowercase methods
57+
),
5458
vol.Optional(CONF_USERNAME): cv.string,
5559
vol.Optional(CONF_PASSWORD): cv.string,
5660
vol.Optional(CONF_PAYLOAD): cv.template,

0 commit comments

Comments
 (0)