Skip to content

Commit 162e78f

Browse files
committed
Code style: camelCase
Signed-off-by: Fabio José <[email protected]>
1 parent 5ec8240 commit 162e78f

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

lib/bindings/http/unmarshaller_0_2.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,18 @@ const Commons = require("./commons.js");
77
const structured = "structured";
88
const binary = "binary";
99

10-
const receiver_by_binding = {
10+
const receiverByBinding = {
1111
structured : new StructuredReceiver(),
1212
binary : new BinaryReceiver(),
1313
};
1414

15-
const allowed_binary_content_types = [];
16-
allowed_binary_content_types.push(Constants.MIME_JSON);
15+
const allowedBinaryContentTypes = [];
16+
allowedBinaryContentTypes.push(Constants.MIME_JSON);
1717

18-
const allowed_structured_content_types = [];
19-
allowed_structured_content_types.push(Constants.MIME_CE_JSON);
18+
const allowedStructuredContentTypes = [];
19+
allowedStructuredContentTypes.push(Constants.MIME_CE_JSON);
2020

21-
function validate_args(payload, headers) {
21+
function validateArgs(payload, headers) {
2222
if(!payload){
2323
throw {message: "payload is null or undefined"};
2424
}
@@ -29,19 +29,19 @@ function validate_args(payload, headers) {
2929
}
3030

3131
// Is it binary or structured?
32-
function resolve_binding_name(payload, headers) {
32+
function resolveBindingName(payload, headers) {
3333

3434
var contentType = headers[Constants.HEADER_CONTENT_TYPE];
3535
if(contentType.startsWith(Constants.MIME_CE)){
3636
// Structured
37-
if(allowed_structured_content_types.includes(contentType)){
37+
if(allowedStructuredContentTypes.includes(contentType)){
3838
return structured;
3939
} else {
4040
throw {message: "structured+type not allowed", errors: [contentType]};
4141
}
4242
} else {
4343
// Binary
44-
if(allowed_binary_content_types.includes(contentType)){
44+
if(allowedBinaryContentTypes.includes(contentType)){
4545
return binary;
4646
} else {
4747
throw {message: "content type not allowed", errors : [contentType]};
@@ -56,20 +56,20 @@ var Unmarshaller = function() {
5656
Unmarshaller.prototype.unmarshall = function(payload, headers) {
5757
return new Promise((resolve, reject) => {
5858
try {
59-
validate_args(payload, headers);
59+
validateArgs(payload, headers);
6060

61-
var sanity_headers = Commons.sanity_and_clone(headers);
61+
var sanityHeaders = Commons.sanity_and_clone(headers);
6262

6363
// Validation level 1
64-
if(!sanity_headers[Constants.HEADER_CONTENT_TYPE]){
64+
if(!sanityHeaders[Constants.HEADER_CONTENT_TYPE]){
6565
throw {message: "content-type header not found"};
6666
}
6767

6868
// Resolve the binding
69-
var binding_name = resolve_binding_name(payload, sanity_headers);
69+
var bindingName = resolveBindingName(payload, sanityHeaders);
7070

7171
var cloudevent =
72-
receiver_by_binding[binding_name].parse(payload, sanity_headers);
72+
receiverByBinding[bindingName].parse(payload, sanityHeaders);
7373

7474
resolve(cloudevent);
7575
}catch(e){

0 commit comments

Comments
 (0)