Skip to content
This repository has been archived by the owner on Oct 11, 2019. It is now read-only.

Response headers X-Wiselinks-Title, X-Wiselinks-Description, etc is not processed #81

Open
Novik opened this issue Jul 17, 2014 · 3 comments · Fixed by wideopenspaces/wiselinks#1 · May be fixed by #82
Open

Response headers X-Wiselinks-Title, X-Wiselinks-Description, etc is not processed #81

Novik opened this issue Jul 17, 2014 · 3 comments · Fixed by wideopenspaces/wiselinks#1 · May be fixed by #82

Comments

@Novik
Copy link

Novik commented Jul 17, 2014

when Wiselnks use as target a standard container (body).
Reason of this is a simple:
_response.js.coffee

  _extract_title: ->
    if @_is_full_document_response()
      $('title', @_get_doc()).text()
    else
      @xhr.getResponseHeader('X-Wiselinks-Title')

  _is_full_document_response: ->
    @_get_doc_target_node().length is 1

  _get_doc_target_node: ->
    @$doc_target_node ?= $(@$target.selector, @_get_doc())

  _get_doc: ->
    @_doc ?= Response._get_document_parser().parse(@html)

_get_doc always return document with a body element. As result, we have _is_full_document_response => true.
Is this a really correct behavior?

@igor-alexandrov
Copy link
Owner

No, of course it is not correct.

@Novik
Copy link
Author

Novik commented Jul 17, 2014

Workaround: add class attribute to the body tag and use corresponding selector as a target.

Спасибо за Вашу работу.

@elbarto132
Copy link

With this fix i'm at least able to set the title using the header.
But shouldn't the header be optional? If i don't set the header in the current version it gets set to an empty string. If i use Novik's patch it gets set to 'null'. I would expect that if i don't set the header the title should just stay.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants