Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.charset(charset) doesn't work on its own in ext #2979

rockbot opened this issue Dec 17, 2015 · 7 comments

.charset(charset) doesn't work on its own in ext #2979

rockbot opened this issue Dec 17, 2015 · 7 comments


Copy link

@rockbot rockbot commented Dec 17, 2015

Desired header: content-type: text/html; charset=utf-8


  server.ext('onPreResponse', function(request, reply) {

    return reply.continue();

results in the following header: content-type: text/html. (text/html is the default content-type header)

The current workaround is to use

  server.ext('onPreResponse', function(request, reply) {

    return reply.continue();

which results in the desired behavior.

@hueniverse hueniverse added the bug label Dec 17, 2015
@hueniverse hueniverse changed the title .charset(charset) doesn't work on its own .charset(charset) doesn't work on its own in ext Dec 27, 2015
Copy link

@hueniverse hueniverse commented Dec 27, 2015

I can't reproduce this (see test). Can you tell me more about the response? What is it? where is it coming from? Maybe a console.log(request.response)?

@hueniverse hueniverse self-assigned this Dec 27, 2015
hueniverse added a commit that referenced this issue Dec 27, 2015
Copy link

@rockbot rockbot commented Jan 4, 2016

here's the way we're using it on the site, which may be able to help:

Copy link

@rockbot rockbot commented Jan 5, 2016

here's request.response:

EventEmitter {
   Domain {
     domain: null,
     _events: { error: [Function] },
     _eventsCount: 1,
     _maxListeners: undefined,
     members: [] },
  _events: {},
  _eventsCount: 0,
  _maxListeners: undefined,
   EventEmitter {
      Domain {
        domain: null,
        _events: [Object],
        _eventsCount: 1,
        _maxListeners: undefined,
        members: [] },
     _events: {},
     _eventsCount: 0,
     _maxListeners: undefined,
     _bench: { ts: 269322030.269452 },
      EventEmitter {
        domain: null,
        _events: [Object],
        _eventsCount: 5,
        _maxListeners: undefined,
        settings: [Object],
        server: [Object],
        type: 'tcp',
        _started: true,
        _connections: [Object],
        _onConnection: [Function],
        registrations: [Object],
        _extensions: [Object],
        _requestCounter: [Object],
        _load: [Object],
        states: [Object],
        auth: [Object],
        _router: [Object],
        plugins: {},
        app: {},
        listener: [Object],
        info: [Object] },
      EventEmitter {
        _settings: [Object],
        _caches: [Object],
        _handlers: [Object],
        _methods: [Object],
        _events: [Object],
        _dependencies: [Object],
        _registrations: [Object],
        _heavy: [Object],
        _mime: [Object],
        _replier: [Object],
        _requestor: [Object],
        _decorations: [Object],
        _plugins: [Object],
        _app: [Object],
        _registring: false,
        _state: 'started',
        _extensionsSeq: 21,
        _extensions: [Object],
        domain: null,
        _maxListeners: undefined,
        _sources: [Object],
        _parent: null,
        root: [Circular],
        app: [Object],
        connections: [Object],
        load: [Object],
        methods: [Object],
        mime: [Object],
        plugins: [Object],
        settings: [Object],
        version: '11.1.2',
        realm: [Object],
        auth: [Object],
        info: [Object],
        listener: [Object],
        registrations: [Object],
        stamp: 'pid=29094 35ca8277aebab542ee8e577cf570bfe3efebcb5e http://localhost:15443 rosie.local ',
        gitHead: '35ca8277aebab542ee8e577cf570bfe3efebcb5e',
        views: [Function],
        render: [Function] },
      Url {
        protocol: null,
        slashes: null,
        auth: null,
        host: null,
        port: null,
        hostname: null,
        hash: null,
        search: null,
        query: {},
        pathname: '/',
        path: '/',
        href: '/' },
     query: {},
     path: '/',
     method: 'get',
     mime: null,
     setUrl: undefined,
     setMethod: undefined,
      { host: 'localhost:15443',
        accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
        connection: 'keep-alive',
        cookie: '__hssrc=1; __hstc=181257784.6748da560b6effaacbfa27d8c35c6ca3.1432149825041.1450306419070.1450388488874.226; _ga=GA1.1.171521356.1416617315; crumb=5RbUn1ZUc4M_-srpFxkgrLOepfQZSU0J3ZlRBqnyGh7; hsfirstvisit=https%3A%2F%2Flocalhost%3A15443%2F||1432149825040; hubspotutk=6748da560b6effaacbfa27d8c35c6ca3; optimizelyBuckets=%7B%7D; optimizelyEndUserId=oeu1447869409699r0.6300706123001873; optimizelySegments=%7B%223318760495%22%3A%22false%22%2C%223320910574%22%3A%22direct%22%2C%223324110209%22%3A%22safari%22%2C%223359291244%22%3A%22none%22%7D',
        'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_2) AppleWebKit/601.3.9 (KHTML, like Gecko) Version/9.0.2 Safari/601.3.9',
        'accept-language': 'en-us',
        dnt: '1',
        'accept-encoding': 'gzip, deflate' },
     id: '1451956569330:rosie.local:29094:ij0pen1u:10000',
     app: {},
      { scooter: [Object],
        crumb: '5RbUn1ZUc4M_-srpFxkgrLOepfQZSU0J3ZlRBqnyGh7' },
      { settings: [Object],
        connection: [Object],
        server: [Object],
        path: '/',
        method: 'get',
        plugin: [Object],
        _special: false,
        _analysis: [Object],
        params: [],
        fingerprint: '/',
        public: [Object],
        _prerequisites: null,
        _extensions: [Object],
        _cycle: [Object] },
      { method: 'get',
        path: '/',
        vhost: undefined,
        realm: [Object],
        settings: [Object],
        fingerprint: '/' },
      { isAuthenticated: false,
        credentials: null,
        artifacts: null,
        session: [Object],
        mode: 'try',
        error: [Object] },
     session: null,
     pre: {},
     preResponses: {},
      { received: 1451956569330,
        responded: 0,
        remoteAddress: '',
        remotePort: 51548,
        referrer: '',
        host: 'localhost:15443',
        acceptEncoding: 'gzip',
        hostname: 'localhost' },
     orig: {},
     params: {},
     paramsArray: [],
     payload: null,
      { __hssrc: '1',
        __hstc: '181257784.6748da560b6effaacbfa27d8c35c6ca3.1432149825041.1450306419070.1450388488874.226',
        _ga: 'GA1.1.171521356.1416617315',
        crumb: '5RbUn1ZUc4M_-srpFxkgrLOepfQZSU0J3ZlRBqnyGh7',
        hsfirstvisit: 'https%3A%2F%2Flocalhost%3A15443%2F||1432149825040',
        hubspotutk: '6748da560b6effaacbfa27d8c35c6ca3',
        optimizelyBuckets: '%7B%7D',
        optimizelyEndUserId: 'oeu1447869409699r0.6300706123001873',
        optimizelySegments: '%7B%223318760495%22%3A%22false%22%2C%223320910574%22%3A%22direct%22%2C%223324110209%22%3A%22safari%22%2C%223359291244%22%3A%22none%22%7D' },
     jsonp: null,
     response: [Circular],
     raw: { req: [Object], res: [Object] },
     addTail: [Function],
     tail: [Function],
     _states: {},
     _logger: [ [Object], [Object], [Object], [Object] ],
     _allowInternals: false,
     _isPayloadPending: true,
     _isBailed: false,
     _isReplied: true,
     _isFinalized: false,
     _tails: {},
     _tailIds: 0,
     _protect: { _error: [Function], logger: [Circular], domain: [Object] },
     _onEnd: [Function],
     _onClose: [Function],
     _onError: [Function],
     render: [Function],
     metrics: StubMetricsEmitter {},
      RedisClient {
        stream: [Object],
        connection_id: 1,
        connected: true,
        ready: true,
        connections: 1,
        should_buffer: false,
        command_queue_high_water: 1000,
        command_queue_low_water: 0,
        max_attempts: 0,
        command_queue: [Object],
        offline_queue: [Object],
        connect_timeout: 86400000,
        enable_offline_queue: true,
        retry_max_delay: null,
        retry_timer: null,
        retry_totaltime: 0,
        retry_delay: 200,
        retry_backoff: 1.7,
        attempts: 1,
        pub_sub_mode: false,
        subscription_set: {},
        monitoring: false,
        closing: false,
        server_info: [Object],
        auth_pass: undefined,
        parser_module: [Object],
        selected_db: null,
        old_state: null,
        options: [Object],
        domain: null,
        _events: [Object],
        _eventsCount: 1,
        _maxListeners: undefined,
        connectionOption: [Object],
        address: 'localhost:6379',
        emitted_end: false,
        reply_parser: [Object],
        send_anyway: false },
      { [Function: boleLogger]
        debug: [Function],
        info: [Function],
        warn: [Function],
        error: [Function] },
     timing: { start: 1451956569343 },
     features: { access_page: true, billing_page: true, org_billing: true },
     saveNotifications: [Function] },
  statusCode: 200,
  headers: { 'Content-Security-Policy': 'connect-src \'self\' https://*;default-src \'self\';font-src \'self\';frame-src;img-src *;script-src \'self\' \'unsafe-eval\';style-src \'self\' \'unsafe-inline\';report-uri /-/csplog' },
  variety: 'view',
  app: {},
  plugins: {},
  send: null,
  hold: undefined,
   { encoding: 'utf8',
     charset: 'utf-8',
     ttl: null,
     stringify: null,
     passThrough: true,
     varyEtag: false },
  _payload: null,
  _takeover: false,
  _contentEncoding: null,
  _error: null,
  _processors: { marshal: [Function], prepare: [Function], close: undefined },
   { manager: { _context: null, _engines: [Object], _defaultExtension: 'hbs' },
     template: 'homepage',
      { correlationID: '1451956569330:rosie.local:29094:ij0pen1u:10000',
        stamp: 'pid=29094 35ca8277aebab542ee8e577cf570bfe3efebcb5e http://localhost:15443 rosie.local ',
        features: [Object],
        devEnv: true,
        env: [Object],
        canonicalURL: 'http://localhost:15443/',
        explicit: [Object],
        modified: [Object],
        dependents: [Object],
        downloads: [Object],
        totalPackages: 161918,
        crumb: '5RbUn1ZUc4M_-srpFxkgrLOepfQZSU0J3ZlRBqnyGh7',
        user: undefined },
     options: undefined,
     compiled: { settings: [Object], template: [Function], layout: [Function] } } }

Copy link

@kanongil kanongil commented Jan 5, 2016

hueniverse added a commit that referenced this issue Mar 10, 2016
Copy link

@hueniverse hueniverse commented Mar 10, 2016

@kanongil Take a look at the new test. I still cannot reproduce this.

Copy link

@kanongil kanongil commented Mar 10, 2016

It fails if you change the generateResponse source option to an object instead of 'text', as it is applied in vision.

Copy link

@hueniverse hueniverse commented Mar 11, 2016

That is so odd. Stupid default types.

@hueniverse hueniverse added this to the 13.1.1 milestone Mar 11, 2016
@lock lock bot locked as resolved and limited conversation to collaborators Jan 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants