Skip to content

Commit 830ae85

Browse files
authored
Merge pull request #207 from lohanidamodar/fix-jwt-issues
fix-jwt-issues
2 parents 5583c9d + 8b32228 commit 830ae85

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/SDK/SDK.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,14 @@ public function __construct(Language $language, Spec $spec)
101101
return str_replace([' ', '_'], '.', strtolower(preg_replace('/([a-zA-Z])(?=[A-Z])/', '$1.', $value)));
102102
}));
103103
$this->twig->addFilter(new TwigFilter('caseSnake', function ($value) {
104-
return str_replace([' ', '-'], '_', strtolower(preg_replace('/([a-zA-Z])(?=[A-Z])/', '$1_', $value)));
104+
preg_match_all('!([A-Za-z][A-Z0-9]*(?=$|[A-Z][a-z0-9])|[A-Za-z][a-z0-9]+)!', $value, $matches);
105+
$ret = $matches[0];
106+
foreach ($ret as &$match) {
107+
$match = $match == strtoupper($match)
108+
? strtolower($match)
109+
: lcfirst($match);
110+
}
111+
return implode('_', $ret);
105112
}));
106113
$this->twig->addFilter(new TwigFilter('caseJson', function ($value) {
107114
return (is_array($value)) ? json_encode($value) : $value;

templates/python/package/client.py.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class Client:
3232
"""{{header.description}}"""
3333

3434
{% endif %}
35-
self._global_headers['{{header.name|lower}}'] = value.lower()
35+
self._global_headers['{{header.name|lower}}'] = value
3636
return self
3737
{% endfor %}
3838

0 commit comments

Comments
 (0)