Fix Bug in camel case conversion (#11)
diff --git a/camel.go b/camel.go
index 5c233cc..ff9e66e 100644
--- a/camel.go
+++ b/camel.go
@@ -27,6 +27,9 @@
buffer = append(buffer, toUpper(curr))
} else if isLower(prev) {
buffer = append(buffer, curr)
+ } else if isUpper(prev) && isUpper(curr) && isLower(next) {
+ // Assume a case like "R" for "XRequestId"
+ buffer = append(buffer, curr)
} else {
buffer = append(buffer, toLower(curr))
}
diff --git a/camel_test.go b/camel_test.go
index a7bc5b8..aa5d18c 100644
--- a/camel_test.go
+++ b/camel_test.go
@@ -24,6 +24,8 @@
"skip many spaces": "SkipManySpaces",
"skip---many-dashes": "SkipManyDashes",
"skip___many_underline": "SkipManyUnderline",
+ "XRequestId": "XRequestId",
+ "HTTPStatusCode": "HttpStatusCode",
}
for in, out := range data {
@@ -47,6 +49,8 @@
"skip many spaces": "skipManySpaces",
"skip---many-dashes": "skipManyDashes",
"skip___many_underline": "skipManyUnderline",
+ "XRequestId": "xRequestId",
+ "HTTPStatusCode": "httpStatusCode",
}
for in, out := range data {