begin 231634    Support posts with query parms in chunked body    WAS.webcontainer
13586
@SuppressWarnings("rawtypes")
    public static Hashtable parsePostData(ServletInputStream in, String encoding, boolean multireadPropertyEnabled) /* 157338 add throws */ throws IOException
    {
        int inputLen;
        byte[] postedBytes = null;
        String postedBody;
        if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE))
			logger.logp(Level.FINE, CLASS_NAME,"parsePostData","parsing chunked post data. encoding = " + encoding);
		
        
        if (in == null)
            throw new IllegalArgumentException("post data inputstream is null");
        try
        {
            //
            // Make sure we read the entire POSTed body.
            //
            ByteArrayOutputStream byteOS = new ByteArrayOutputStream(DEFAULT_BUFFER_SIZE);
            do
            {
            	byte [] readInBytes = new byte[DEFAULT_BUFFER_SIZE];
            	inputLen = in.read(readInBytes, 0, DEFAULT_BUFFER_SIZE);
            	if (inputLen > 0){
            		byteOS.write(readInBytes,0,inputLen);
            	}
            }
            while (inputLen != -1);
            
            // MultiRead Start
            if (multireadPropertyEnabled) {
                in.close();
            }
            // MultiRead End
            
            postedBytes = byteOS.toByteArray();
            if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE))
    			logger.logp(Level.FINE, CLASS_NAME,"parsePostData","finished reading ["+postedBytes.length+"] bytes");
    		
        }
        catch (IOException e)
        {
            com.ibm.wsspi.webcontainer.util.FFDCWrapper.processException(e, "com.ibm.ws.webcontainer.servlet.RequestUtils.parsePostData", "598");
            // begin 157338
            throw e;
            //return new Hashtable();
            // begin 157338
        }
        // XXX we shouldn't assume that the only kind of POST body
        // is FORM data encoded using ASCII or ISO Latin/1 ... or
        // that the body should always be treated as FORM data.
        //
        try
        {
            postedBody = new String(postedBytes, encoding);
        }
        catch (UnsupportedEncodingException e)
        {
            com.ibm.wsspi.webcontainer.util.FFDCWrapper.processException(e, "com.ibm.ws.webcontainer.servlet.RequestUtils.parsePostData", "618");
            postedBody = new String(postedBytes);
        }
        
        if (WCCustomProperties.PARSE_UTF8_POST_DATA && encoding.equalsIgnoreCase("UTF-8")) {
            for (byte nextByte : postedBytes) {
            	if (nextByte < (byte)0 ) {
            		encoding = "8859_1";            		
                    if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE))
            			logger.logp(Level.FINE, CLASS_NAME,"parsePostData","UTF8 post data, set encoing to 8859_1 to prevent futrther encoding");
        	        break;
            	}    	
            }
        }    

        
        return parseQueryString(postedBody, encoding);
    }
39179
function parseBodyParam (req, res, next) {
  let params = getParams(req);

  params.some((param) => {
    if (param.in === "body") {
      util.debug('    Parsing the "%s" body parameter', param.name);

      if (_.isPlainObject(req.body) && _.isEmpty(req.body)) {
        if (param.type === "string" || (param.schema && param.schema.type === "string")) {
          // Convert {} to ""
          req.body = "";
        }
        else {
          // Convert {} to undefined
          req.body = undefined;
        }
      }

      // Parse the body
      req.body = parseParameter(param, req.body, param.schema);

      // There can only be one "body" parameter, so skip the rest
      return true;
    }
  });

  // If there are no body/formData parameters, then reset `req.body` to undefined
  if (params.length > 0) {
    let hasBody = params.some((param) => {
      return param.in === "body" || param.in === "formData";
    });

    if (!hasBody) {
      req.body = undefined;
    }
  }

  next();
}
174968
def _parse_posts(element):
    

    posts = []
    items = element.findall("item")

    for item in items:
        title = item.find("./title").text
        link = item.find("./link").text
        pub_date = item.find("./pubDate").text
        creator = item.find("./{%s}creator" % DC_NAMESPACE).text
        guid = item.find("./guid").text
        description = item.find("./description").text
        content = item.find("./{%s}encoded" % CONTENT_NAMESPACE).text
        excerpt = item.find("./{%s}encoded" % EXCERPT_NAMESPACE).text
        post_id = item.find("./{%s}post_id" % WP_NAMESPACE).text
        post_date = item.find("./{%s}post_date" % WP_NAMESPACE).text
        post_date_gmt = item.find("./{%s}post_date_gmt" % WP_NAMESPACE).text
        status = item.find("./{%s}status" % WP_NAMESPACE).text
        post_parent = item.find("./{%s}post_parent" % WP_NAMESPACE).text
        menu_order = item.find("./{%s}menu_order" % WP_NAMESPACE).text
        post_type = item.find("./{%s}post_type" % WP_NAMESPACE).text
        post_name = item.find("./{%s}post_name" % WP_NAMESPACE).text
        is_sticky = item.find("./{%s}is_sticky" % WP_NAMESPACE).text
        ping_status = item.find("./{%s}ping_status" % WP_NAMESPACE).text
        post_password = item.find("./{%s}post_password" % WP_NAMESPACE).text
        category_items = item.findall("./category")

        categories = []
        tags = []

        for category_item in category_items:
            if category_item.attrib["domain"] == "category":
                item_list = categories
            else:
                item_list = tags

            item_list.append(category_item.attrib["nicename"])

        post = {
            "title": title,
            "link": link,
            "pub_date": pub_date,
            "creator": creator,
            "guid": guid,
            "description": description,
            "content": content,
            "excerpt": excerpt,
            "post_id": post_id,
            "post_date": post_date,
            "post_date_gmt": post_date_gmt,
            "status": status,
            "post_parent": post_parent,
            "menu_order": menu_order,
            "post_type": post_type,
            "post_name": post_name,
            "categories": categories,
            "is_sticky": is_sticky,
            "ping_status": ping_status,
            "post_password": post_password,
            "tags": tags,
        }

        post["postmeta"] = _parse_postmeta(item)
        post["comments"] = _parse_comments(item)
        posts.append(post)

    return posts
896508
function POST(uri, params) {
	var form = new FormData();

	for (var i in params) {
		form.append(i, params[i]);
	}

	const requestURL = `${uri}`;
	log(`request URL: ${requestURL}`);

	return fetch(requestURL, { method: 'POST', compress: compress, body: form, headers: { 'Content-Type': 'multipart/form-data; boundary='+form.getBoundary() } })
    .then(function handleRequest(res) {
			const status = res.status;
			if (status != 200) {
				const error = new Error(`Request failed: ${status}`);
				error.status = status;
				throw error;
			}
			return res.json();
		})
		.catch(error => {
			log(`error: ${error}`);
			throw error;
		});
}
1305297
function posts (content, contentType) {
  let output = {}
  const allFiles = content.filter(each => each.dir.includes(`/${contentType}`))
  const index = allFiles.filter(each => each.base === 'index.md')[0]
  index.attr.forEach(each => {
    allFiles.forEach(file => {
      if (file.name === each) {
        output[each] = file
      }
    })
  })
  return output
}
910028
def post_parse(self, uri, params={}, data={}):
        '''
        '''
        return self._request_parse(self.post, uri, params, data)
677043
function parseAhead( router, req, done ) {
	var idx = 0;
	var stack = router.stack;
	var params = {};
	var method = req.method ? req.method.toLowerCase() : undefined;
	next();

	function next() {
		var layer = stack[ idx++ ];
		if ( !layer ) {
			// strip dangling query params
			params = _.transform( params, function( acc, v, k ) {
				acc[ k ] = v.split( '?' )[ 0 ]; return acc;
			}, {} );
			return done( params );
		}

		if ( layer.method && layer.method !== method ) {
			return next();
		}
		layer.match( req.originalUrl );
		params = _.merge( params, layer.params );
		next();
	}
}
292580
function GET(uri, params) {
	const reqUrl = `${uri}${url.format({ query: params })}`;

	log(`request URL: ${reqUrl}`);

	return fetch(reqUrl)
		.then(function handleGetRequest(res) {
			const status = res.status;
			const statusText = res.statusText;

			log(`status code: ${status}`);
			log(`status text: ${statusText}`);

			if (status !== 200) {
				const err = new Error(`Request failed: ${statusText}`);

				err.status = status;

				throw err;
			}

			return res.json();
		})
		.then(data => {
			const posts = data.posts;

			log(`${posts.length} posts were fetched`);

			return posts;
		})
		.catch(err => {
			log('catched err: ', err);

			throw err;
		});
}
914786
function(source, params) {
			var tags = Tags.tagTemplates;
			var proposals = [];
			var namePrefix = params.prefix ? params.prefix : "";
			var precedingChar = source.charAt(params.offset - namePrefix.length - 1);
			if (namePrefix.length === 0){
				while (precedingChar === '!' || precedingChar === '-'){
					namePrefix = precedingChar + namePrefix;
					precedingChar = source.charAt(params.offset - namePrefix.length - 1);
				}
				if (namePrefix.match(/^!-?$/)){
					var prefix = '<' + namePrefix;
					proposals.push(this.makeComputedProposal("<!-- ", Messages['openCommentName'], " - <!-- -->", null, prefix)); //$NON-NLS-1$ //$NON-NLS-2$
					return proposals;
				}
			}
			var leadingBracket = false;
			if (precedingChar === '<'){
				leadingBracket = true;
			}
			for(var j = 0; j < tags.length; j++) {
				var tag = tags[j];
				if(jsUtil.looselyMatches(namePrefix, tag.name)) {
					var hover = Object.create(null);
					hover.type = 'markdown'; //$NON-NLS-1$
					hover.content = "";
					if (tag.obsolete){
						hover.content += Messages['obsoleteTag'];
					}
					if (tag.doc){
						hover.content += tag.doc;
					}
					if(tag.url) {
						hover.content += i18nUtil.formatMessage(Messages['onlineDocumentation'], tag.url);
					}
					var proposalText = "";
					var desc = "";
					// TODO Allow tags to have custom templates
					tag.type = 'single'; //$NON-NLS-1$
					switch (tag.type) {
						case 'single':
							proposalText = "<" + tag.name + "></" + tag.name + ">"; //$NON-NLS-1$
//							desc = " - " + proposalText;
							if (leadingBracket){
								proposalText = proposalText.substring(1);
							}
							break;
						case 'multi':
							proposalText = "<" + tag.name + ">\n\n</" + tag.name + ">"; //$NON-NLS-1$
//							desc = " - " + proposalText;
							if (leadingBracket){
								proposalText = proposalText.substring(1);
							}
							break;
						case 'empty':
							proposalText = "<" + tag.name + "/>"; //$NON-NLS-1$
//							desc = " - " + proposalText;
							if (leadingBracket){
								proposalText = proposalText.substring(1);
							}
							break;
						default:
							proposalText = "<" + tag.name + ">";
//							desc = " - " + proposalText;
							if (leadingBracket){
								proposalText = proposalText.substring(1);
							}
							break;
					}
					var style = "emphasis";
					if (tag.obsolete){
						style = "strikethrough";
						//desc += Messages['obsoleteTagDesc'];
					}
					var proposal = this.makeComputedProposal(proposalText, tag.name, desc, hover, params.prefix, style);
					// The prefix not being includes prevents content assist staying open while typing
//					if (source.charAt(params.offset - prefix.length - 1) === '<'){
//						prefix = '<' + prefix;
//						proposal.prefix = prefix;
//					}
					proposal.escapePosition = params.offset - namePrefix.length + tag.name.length + 2;
					if(leadingBracket){
						proposal.escapePosition--;
					}
					proposals.push(proposal);
				}
			}
			return proposals;	
		}
950055
def get_posts(self, offset=0, limit=1000, order=None, filters=None):
        
        order = self._get_order(order)
        cache_key = self.get_cache_key(offset, limit, order, filters)
        content = cache.get(cache_key)
#        if content:
#            return content
        try:
            if self.up_to_date():
                pass # not time to update yet
            else:
                self.update()
        except:
            raise
            pass # query the database for now and update later
        query = self._get_query(order=order, filters=filters)
        posts = query[int(offset):int(offset)+int(limit)]
        posts = self._format(posts)
        cache_duration = conf.GOSCALE_CACHE_DURATION if posts else 1
        cache.set(cache_key, posts, cache_duration)
        return posts
1031585
def parse_query(query, delim='/'):
        
        key = ''
        prefix = ''
        postfix = ''

        parsed = urlparse(query)
        query = parsed.path.lstrip(delim)
        bucket = parsed.netloc

        if not parsed.scheme.lower() in ('', "gs", "s3", "s3n"):
            raise ValueError("Query scheme must be one of '', 'gs', 's3', or 's3n'; "
                             "got: '%s'" % parsed.scheme)
        storage = parsed.scheme.lower()

        if not bucket.strip() and query:
            toks = query.split(delim, 1)
            bucket = toks[0]
            if len(toks) == 2:
                key = toks[1]
            else:
                key = ''

        if not bucket.strip():
            raise ValueError("Could not parse bucket name from query string '%s'" % query)

        tokens = query.split("*")
        n = len(tokens)
        if n == 0:
            pass
        elif n == 1:
            key = tokens[0]
        elif n == 2:
            index = tokens[0].rfind(delim)
            if index >= 0:
                key = tokens[0][:(index + 1)]
                prefix = tokens[0][(index + 1):] if len(tokens[0]) > (index + 1) else ''
            else:
                prefix = tokens[0]
            postfix = tokens[1]
        else:
            raise ValueError("Only one wildcard ('*') allowed in query string, got: '%s'" % query)

        return storage, bucket, key, prefix, postfix
286046
function handleQuery() {
  let query = parseQuery();
  let url = window.location.protocol + '//' + window.location.hostname + ':' +
            window.location.port + ELASTICSEARCH_INTERFACE_ROUTE;
  let httpRequest = new XMLHttpRequest();

  httpRequest.onreadystatechange = function() {
    if(httpRequest.readyState === XMLHttpRequest.DONE) {
      if(httpRequest.status === 200) {
        let response = JSON.parse(httpRequest.responseText);
        updateResults(response);
        updateHits(response);
        updateAggregations(response);
        show(queryResults);
      }
      else {
        queryError.textContent = 'Query returned status ' +
                                 httpRequest.status +
                                 '. Is Elasticsearch connected and running?';
        hide(queryResults);
        hide(queryButton);
        show(queryError);
      }
    }
  };
  httpRequest.open('POST', url);
  httpRequest.setRequestHeader('Content-Type', 'application/json');
  httpRequest.setRequestHeader('Accept', 'application/json');
  httpRequest.send(JSON.stringify(query));
}
122209
@Override
    public List<QueryRow> regularQuery(final QueryOptions options) throws CouchbaseLiteException {

        final Predicate<QueryRow> postFilter = options.getPostFilter();

        int tmpLimit = QueryOptions.QUERY_OPTIONS_DEFAULT_LIMIT;
        int tmpSkip = 0;
        if (postFilter != null) {
            // #574: Custom post-filter means skip/limit apply to the filtered rows, not to the
            // underlying query, so handle them specially:
            tmpLimit = options.getLimit();
            tmpSkip = options.getSkip();
            if (tmpLimit == 0)
                return new ArrayList<QueryRow>(); // empty result set
            options.setLimit(QueryOptions.QUERY_OPTIONS_DEFAULT_LIMIT);
            options.setSkip(0);
        }

        final CountDown skip = new CountDown(tmpSkip);
        final CountDown limit = new CountDown(tmpLimit);

        final List<QueryRow> rows = new ArrayList<QueryRow>();

        Status status = runQuery(options, new QueryRowBlock() {
            @Override
            public Status onRow(byte[] keyData, byte[] valueData, String docID, Cursor cursor) {
                JsonDocument keyDoc = new JsonDocument(keyData);
                JsonDocument valueDoc = new JsonDocument(valueData);
                long sequence = Long.parseLong(cursor.getString(3));
                RevisionInternal docRevision = null;
                if (options.isIncludeDocs()) {
                    Object valueObject = valueDoc.jsonObject();
                    String linkedID = null;
                    if (valueObject instanceof Map)
                        linkedID = (String) ((Map) valueObject).get("_id");
                    if (linkedID != null) {
                        // Linked document: http://wiki.apache.org/couchdb/Introduction_to_CouchDB_views#Linked_documents
                        String linkedRev = (String) ((Map) valueObject).get("_rev");
                        Status linkedStatus = new Status();
                        docRevision = store.getDocument(linkedID, linkedRev, true, linkedStatus);
                        sequence = docRevision.getSequence();
                    } else {
                        String revID = cursor.getString(4);
                        byte[] json = cursor.getBlob(5);
                        Map<String, Object> properties = store.documentPropertiesFromJSON(
                                json,
                                docID,
                                revID,
                                false,
                                sequence);
                        docRevision = SQLiteStore.revision(
                                docID,    // docID
                                revID,    // revID
                                false,    // deleted
                                sequence, // sequence
                                properties// properties
                        );
                    }
                }
                QueryRow row = new QueryRow(docID, sequence,
                        keyDoc.jsonObject(), valueDoc.jsonObject(),
                        docRevision);
                if (postFilter != null) {
                    if (!postFilter.apply(row)) {
                        return new Status(Status.OK);
                    }
                    if (skip.getCount() > 0) {
                        skip.countDown();
                        return new Status(Status.OK);
                    }

                }
                rows.add(row);

                if (limit.countDown() == 0)
                    return new Status(0); /// stops the iteration
                return new Status(Status.OK);
            }
        });

        // If given keys, sort the output into that order, and add entries for missing keys:
        if (options.getKeys() != null && options.getKeys().size() > 0) {
            // Group rows by key:
            Map<Object, List<QueryRow>> rowsByKey = new HashMap<Object, List<QueryRow>>();
            for (QueryRow row : rows) {
                List<QueryRow> rs = rowsByKey.get(row.getKey());
                if (rs == null) {
                    rs = new ArrayList<QueryRow>();
                    rowsByKey.put(row.getKey(), rs);
                }
                rs.add(row);
            }

            // Now concatenate them in the order the keys are given in options:
            final List<QueryRow> sortedRows = new ArrayList<QueryRow>();
            for (Object key : options.getKeys()) {
                JsonDocument jsonDoc = null;
                try {
                    byte[] keyBytes = Manager.getObjectMapper().writeValueAsBytes(key);
                    jsonDoc = new JsonDocument(keyBytes);
                } catch (JsonProcessingException e) {
                    throw new CouchbaseLiteException(Status.INTERNAL_SERVER_ERROR);
                }
                List<QueryRow> rs = rowsByKey.get(jsonDoc.jsonObject());
                if (rs != null)
                    sortedRows.addAll(rs);
            }

            return sortedRows;
        }

        return rows;
    }
442427
function findBlogs (pRequest, pResponse) {

    var query       = pRequest.params.query,
        posts       = cache.get('posts') || {};

    var blogsToSend = [];

    for (var key in posts) {
        var post = new Post(posts[key]);
        if (post.containsQuery(query))
        {
            blogsToSend.push(posts[key]);
        }
    }
    return pResponse.status(201).send(blogsToSend).end();
}
1299374
def query(self,
              startTime=None,
              endTime=None,
              sinceServerStart=False,
              level="WARNING",
              services="*",
              machines="*",
              server="*",
              codes=[],
              processIds=[],
              export=False,
              exportType="CSV", #CSV or TAB
              out_path=None
              ):
        
        allowed_levels = ("SEVERE", "WARNING", "INFO",
                          "FINE", "VERBOSE", "DEBUG")
        qFilter = {
            "services": "*",
            "machines": "*",
            "server" : "*"
        }
        if len(processIds) > 0:
            qFilter['processIds'] = processIds
        if len(codes) > 0:
            qFilter['codes'] = codes
        params = {
            "f" : "json",
            "sinceServerStart" : sinceServerStart,
            "pageSize" : 10000
        }
        if startTime is not None and \
           isinstance(startTime, datetime):
            params['startTime'] = startTime.strftime("%Y-%m-%dT%H:%M:%S")
        if endTime is not None and \
           isinstance(endTime, datetime):
            params['endTime'] = endTime.strftime("%Y-%m-%dT%H:%M:%S")
        if level.upper() in allowed_levels:
            params['level'] = level
        if server != "*":
            qFilter['server'] = server.split(',')
        if services != "*":
            qFilter['services'] = services.split(',')
        if machines != "*":
            qFilter['machines'] = machines.split(",")
        params['filter'] = qFilter
        if export == True and \
           out_path is not None:
            messages = self._post(self._url + "/query", params,
                                     securityHandler=self._securityHandler,
                                     proxy_url=self._proxy_url,
                                     proxy_port=self._proxy_port)

            with open(name=out_path, mode='wb') as f:
                hasKeys = False
                if exportType == "TAB":
                    csvwriter = csv.writer(f, delimiter='\t')
                else:
                    csvwriter = csv.writer(f)
                for message in messages['logMessages']:
                    if hasKeys == False:
                        csvwriter.writerow(message.keys())
                        hasKeys = True
                    csvwriter.writerow(message.values())
                    del message
            del messages
            return out_path
        else:
            return self._post(self._url + "/query", params,
                                 securityHandler=self._securityHandler,
                                 proxy_url=self._proxy_url,
                                 proxy_port=self._proxy_port)
1131968
function (params, cb) {

            if (params) {
                params._method = 'POST';
            }

            params.formEncoded = true;

            if (typeof params.file != "undefined" || typeof params.url != "undefined") {

                _util.buildQuery('', params, function (error, data) {

                    return cb(error, data);

                });

            } else {

                return cb(new Error('Please provide file or url path!'));

            }

        }
693145
function parseBODYSTRUCTURE(node, path = []) {
  let curNode = {};
  let i = 0;
  let part = 0;

  if (path.length) {
    curNode.part = path.join('.');
  }

  // multipart
  if (Array.isArray(node[0])) {
    curNode.childNodes = [];
    while (Array.isArray(node[i])) {
      curNode.childNodes.push(parseBODYSTRUCTURE(node[i], path.concat(++part)));
      i++;
    }

    // multipart type
    curNode.type = 'multipart/' + ((node[i++] || {}).value || '').toString().toLowerCase();

    // extension data (not available for BODY requests)

    // body parameter parenthesized list
    if (i < node.length - 1) {
      if (node[i]) {
        curNode.parameters = attributesToObject(node[i]);
      }
      i++;
    }
  } else {
    // content type
    curNode.type = [((node[i++] || {}).value || '').toString().toLowerCase(), ((node[i++] || {}).value || '').toString().toLowerCase()].join('/');

    // body parameter parenthesized list
    if (node[i]) {
      curNode.parameters = attributesToObject(node[i]);
    }
    i++;

    // id
    if (node[i]) {
      curNode.id = ((node[i] || {}).value || '').toString();
    }
    i++;

    // description
    if (node[i]) {
      curNode.description = ((node[i] || {}).value || '').toString();
    }
    i++;

    // encoding
    if (node[i]) {
      curNode.encoding = ((node[i] || {}).value || '').toString().toLowerCase();
    }
    i++;

    // size
    if (node[i]) {
      curNode.size = Number((node[i] || {}).value || 0) || 0;
    }
    i++;

    if (curNode.type === 'message/rfc822') {
      // message/rfc adds additional envelope, bodystructure and line count values

      // envelope
      if (node[i]) {
        curNode.envelope = parseENVELOPE([].concat(node[i] || []));
      }
      i++;

      if (node[i]) {
        curNode.childNodes = [
        // rfc822 bodyparts share the same path, difference is between MIME and HEADER
        // path.MIME returns message/rfc822 header
        // path.HEADER returns inlined message header
        parseBODYSTRUCTURE(node[i], path)];
      }
      i++;

      // line count
      if (node[i]) {
        curNode.lineCount = Number((node[i] || {}).value || 0) || 0;
      }
      i++;
    } else if (/^text\//.test(curNode.type)) {
      // text/* adds additional line count values

      // line count
      if (node[i]) {
        curNode.lineCount = Number((node[i] || {}).value || 0) || 0;
      }
      i++;
    }

    // extension data (not available for BODY requests)

    // md5
    if (i < node.length - 1) {
      if (node[i]) {
        curNode.md5 = ((node[i] || {}).value || '').toString().toLowerCase();
      }
      i++;
    }
  }

  // the following are shared extension values (for both multipart and non-multipart parts)
  // not available for BODY requests

  // body disposition
  if (i < node.length - 1) {
    if (Array.isArray(node[i]) && node[i].length) {
      curNode.disposition = ((node[i][0] || {}).value || '').toString().toLowerCase();
      if (Array.isArray(node[i][1])) {
        curNode.dispositionParameters = attributesToObject(node[i][1]);
      }
    }
    i++;
  }

  // body language
  if (i < node.length - 1) {
    if (node[i]) {
      curNode.language = [].concat(node[i]).map(val => (0, _ramda.propOr)('', 'value', val).toLowerCase());
    }
    i++;
  }

  // body location
  // NB! defined as a "string list" in RFC3501 but replaced in errata document with "string"
  // Errata: http://www.rfc-editor.org/errata_search.php?rfc=3501
  if (i < node.length - 1) {
    if (node[i]) {
      curNode.location = ((node[i] || {}).value || '').toString();
    }
    i++;
  }

  return curNode;
}