This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "express", | |
"hostname": "surfingcat.local", | |
"pid": 23560, | |
"req_id": "a5674c8b-d77b-4996-b1c1-e5856a8fddf8", | |
"level": 30, | |
"remote-address": "127.0.0.1", | |
"ip": "127.0.0.1", | |
"method": "POST", | |
"url": "/api/financials/", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let financials = [ | |
[ | |
"amount": 777, | |
"date": "2016-09-24", | |
"rate": 1, | |
"text": "string", | |
"category": "string", | |
"uuid": "string", | |
], | |
[ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension String: ParameterEncoding { | |
public func encode(_ urlRequest: URLRequestConvertible, with parameters: Parameters?) throws -> URLRequest { | |
var request = try urlRequest.asURLRequest() | |
request.httpBody = data(using: .utf8, allowLossyConversion: false) | |
request.setValue("application/json", forHTTPHeaderField: "Content-Type") | |
return request | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let parameters: Parameters = [ | |
"foo": "bar", | |
"baz": ["a", 1], | |
"qux": [ | |
"x": 1, | |
"y": 2, | |
"z": 3 | |
] | |
] | |
Alamofire.request("https://httpbin.org/post", parameters: parameters, encoding: URLEncoding.httpBody) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict' | |
const chakram = require('chakram') | |
const expect = chakram.expect | |
const Promise = require('bluebird') | |
let config = { | |
API_URL: process.env.API_URL ? process.env.API_URL : 'http://0.0.0.0:3015/api/', | |
headers: null | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let getAllRecords = () => { | |
return new Promise((resolve, reject) => { | |
const ldapClient = ldapjs.createClient(ldapOptions); | |
// 1 | |
ldapClient.bind( | |
ldapConfig.managerUser, | |
ldapConfig.managerUserPassword, | |
err => { | |
if (err) return reject(err); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let changePassword = (userId, passwordOld, passwordNew) => { | |
return new Promise((resolve, reject) => { | |
const ldapClient = ldapjs.createClient(ldapOptions); | |
// 1 | |
ldapClient.bind( | |
'cn=' + userId + ',' + ldapConfig.domain, | |
passwordOld, | |
err => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let authenticate = (userId, password) => { | |
return new Promise((resolve, reject) => { | |
const ldapClient = ldapjs.createClient(ldapOptions); | |
ldapClient.bind( | |
'cn=' + userId + ',' + ldapConfig.domain, | |
password, | |
(err, res) => { | |
if (err) { | |
//@see https://github.com/mcavage/node-ldapjs/blob/7059cf6b8a0b4ff4c566714d97f3cef04f887c3b/test/client.test.js @ 305 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ldapClient.on('error', function (err) { | |
if (err.syscall == "connect") { | |
console.log(err); | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let addUser = (userId, givenName, familyName, password) => { | |
return new Promise((resolve, reject) => { | |
// 1 | |
const ldapClient = ldapjs.createClient(ldapOptions); | |
// 2 | |
ldapClient.bind( | |
ldapConfig.pwdUser, | |
ldapConfig.pwdUserPassword, |