Skip to content
This repository has been archived by the owner on Sep 24, 2018. It is now read-only.

Missing 'wp/v2' in path in Location Response header #1790

Merged
merged 1 commit into from
Dec 7, 2015

Conversation

johanmynhardt
Copy link
Contributor

When submitting a Post Meta Create request, the response contains
a Location header with 'wp/v2' missing from the path.

Currently either $this->parent_base returns the wrong (empty) base,
or wp/v2/ is missing from the base when setting the Location header
for a Post Meta Create response.

Actual Location header

c.a.w.w.v.Client.debugRequest() - Request Entity:\
    <POST http://johan-wp/wp-json/wp/v2/posts/3766/meta,\
    {key=Gomxw, value=bLfaU},\
    {Authorization=[Basic am9oYW4ubXluaGFyZHQ6d29yZHByZXNzIQ==]}>
c.a.w.w.v.Client.debugHeaders() - Response Headers:
...
c.a.w.w.v.Client.lambda$debugHeaders$8() - \
    Location -> [http://johan-wp/wp-json/posts/3766/meta/11965]
...

Expected Location header

c.a.w.w.v.Client.debugRequest() - Request Entity:\
    <POST http://johan-wp/wp-json/wp/v2/posts/3766/meta,\
    {key=Gomxw, value=bLfaU},\
    {Authorization=[Basic am9oYW4ubXluaGFyZHQ6d29yZHByZXNzIQ==]}>
c.a.w.w.v.Client.debugHeaders() - Response Headers:
...
c.a.w.w.v.Client.lambda$debugHeaders$8() - \
    Location -> [http://johan-wp/wp-json/wp/v2/posts/3766/meta/11965]
...

Currently either $this->parent_base returns the wrong (empty) base, or 'wp/v2/' is missing from the base.

Actual Location header

    c.a.w.w.v.Client.debugRequest() - Request Entity: <POST http://johan-wp/wp-json/wp/v2/posts/3766/meta,{key=Gomxw, value=bLfaU},{Authorization=[Basic am9oYW4ubXluaGFyZHQ6d29yZHByZXNzIQ==]}>
    c.a.w.w.v.Client.debugHeaders() - Response Headers:
    ...
    c.a.w.w.v.Client.lambda$debugHeaders$8() - Location -> [http://johan-wp/wp-json/posts/3766/meta/11965]
    ...

Expected Location header

    c.a.w.w.v.Client.debugRequest() - Request Entity: <POST http://johan-wp/wp-json/wp/v2/posts/3766/meta,{key=Gomxw, value=bLfaU},{Authorization=[Basic am9oYW4ubXluaGFyZHQ6d29yZHByZXNzIQ==]}>
    c.a.w.w.v.Client.debugHeaders() - Response Headers:
    ...
    c.a.w.w.v.Client.lambda$debugHeaders$8() - Location -> [http://johan-wp/wp-json/wp/v2/posts/3766/meta/11965]
    ...
@danielbachhuber danielbachhuber added this to the 2.0 Beta 9 milestone Dec 7, 2015
@danielbachhuber
Copy link
Member

Thanks for the fix!

danielbachhuber added a commit that referenced this pull request Dec 7, 2015
Missing 'wp/v2' in path in Location Response header
@danielbachhuber danielbachhuber merged commit 3dc2418 into WP-API:develop Dec 7, 2015
@johanmynhardt johanmynhardt deleted the patch-1 branch December 7, 2015 16:01
@johanmynhardt johanmynhardt restored the patch-1 branch December 7, 2015 16:08
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants