You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was able to fix this issue by only returning headers instead of redirecting. This was accomplished in my Rails API by placing the following code in my create action:
def create
@passage = Passage.new(passage_params)
respond_to do |format|
if @passage.save
# formatting this way is required for Angularjs app to not return a http 406 status
format.html do
head 200, content_type: "text/plain"
end
format.json { render json: @passage.to_json }
# previous code is commented out in the following 2 lines
# format.html { redirect_to @passage, notice: 'Passage was successfully created.' }
# format.json { render :show, status: :created, location: @passage }
else
format.html { render :new }
format.json { render json: @passage.errors, status: :unprocessable_entity }
end
end
This
OPTIONS
request in this comment should not be returning CORS headers: #20 (comment)The text was updated successfully, but these errors were encountered: