UNPKG

@hapiness/ng-universal

Version:

This is a Hapiness Engine for running Angular Apps on the server for server side rendering.

49 lines 1.8 kB
"use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; Object.defineProperty(exports, "__esModule", { value: true }); const core_1 = require("@hapiness/core"); const cookie_1 = require("cookie"); let HttpUtils = class HttpUtils { /** * Parse a cookie header. * * Parse the given cookie header string into an object * The object has the various cookies as keys(names) => values * * @param {string} str * @param {object} [options] * * @return {object} */ parseCookie(str, options) { return cookie_1.parse(str, options); } /** * Serialize data into a cookie header. * * Serialize the a name value pair into a cookie string suitable for * http headers. An optional options object specified cookie parameters. * * serialize('foo', 'bar', { httpOnly: true }) * => "foo=bar; httpOnly" * * @param {string} name * @param {string} value * @param {object} [options] * * @returns {string} */ serializeCookie(name, value, options) { return cookie_1.serialize(name, value, options); } }; HttpUtils = __decorate([ core_1.Service() ], HttpUtils); exports.HttpUtils = HttpUtils; //# sourceMappingURL=http.utils.js.map