Skip to content

Add location to response? #289

@amosjyng

Description

@amosjyng

Right now this unit test doesn't pass:

      it "returns 201 with corresponding location" do
        request.env['CONTENT_TYPE'] = 'application/vnd.api+json'
        post :create, valid_attributes, valid_session
        expect(response.status).to eq(201)
        expect(response_body['data']['links']['self']).to eq(v1_concept_url(Concept.last)) # this passes
        expect(response.location).to eq(v1_concept_url(Concept.last)) # not this
      end

It would appear the response location header is not set?

     Failure/Error: expect(response.location).to eq(v1_concept_url(Concept.last))

       expected: "http://test.host/v1/concepts/730"
            got: nil

       (compared using ==)

The JSONAPI spec does seem to require it, though.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions