8000 url in location header should be a string not a link array by Wilt · Pull Request #97 · zfcampus/zf-rest · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Jan 21, 2020. It is now read-only.

url in location header should be a string not a link array #97

Merged
merged 1 commit into from
Jul 12, 2016

Conversation

Wilt
Copy link
Contributor
@Wilt Wilt commented Mar 17, 2016

When we want to render self links with more then just a 'href' field then adding the Location header line in the RestController::create method on line 401 fails.

This because currently the $selfLinkUrl is an array like this:

[ 'href' => 'api/v1/path/to/resource' ];

This works fine as long as the href is the only key in the array, but as soon as the array has more members it fails.
Solution is to simply pass only the url string:

$link = $halEntity->getLinks()->get('self');
$selfLinkUrl = $plugin->fromLink($self);
$self = $plugin->fromLink($link);
$url = $self['href'];

//...

$response->getHeaders()->addHeaderLine('Location', $url);

@weierophinney weierophinney added this to the 1.2.1 milestone Jul 12, 2016
@weierophinney weierophinney self-assigned this Jul 12, 2016
@weierophinney weierophinney merged commit 81d5cee into zfcampus:master Jul 12, 2016
weierophinney added a commit that referenced this pull request Jul 12, 2016
url in location header should be a string not a link array
weierophinney added a commit that referenced this pull request Jul 12, 2016
weierophinney added a commit that referenced this pull request Jul 12, 2016
weierophinney added a commit that referenced this pull request Jul 12, 2016
weierophinney added a commit that referenced this pull request Jul 12, 2016
Forward port #97

Conflicts:
	CHANGELOG.md
	test/CollectionIntegrationTest.php
@Wilt Wilt deleted the patch-4 branch July 13, 2016 11:21
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
0