Fix JSON format in some controller actions
<!--IssueSummary start--> <details> <summary> Everyone can contribute. [Help move this issue forward](https://handbook.gitlab.com/handbook/marketing/developer-relations/contributor-success/community-contributors-workflows/#contributor-links) while earning points, leveling up and collecting rewards. </summary> - [Close this issue](https://contributors.gitlab.com/manage-issue?action=close&projectId=278964&issueIid=24310) </details> <!--IssueSummary end--> There are some controller actions rendering strings instead of `JSON`. We should do `render json: {error: 'any string'} instead of `render json: 'any string'` ``` sh app/controllers/concerns/uploads_actions.rb: render json: "Error uploading file", status: :internal_server_error app/controllers/projects/merge_requests_controller.rb: render json: '', status: :no_content app/controllers/admin/users_controller.rb: format.json { render json: 'There was an error removing the e-mail.', status: :bad_request } app/controllers/application_controller.rb: format.js { render json: '', status: :not_found, content_type: 'application/json' } app/controllers/concerns/uploads_actions.rb: render json: 'Invalid file.', status: :unprocessable_entity ``` The following discussion from gitlab-ce!21774 should be addressed: - [ ] @stanhu started a [discussion](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/21774#note_103421778): (+1 comment) > That's not valid JSON either: > > ```ruby > irb(main):002:0> JSON.parse('Invalid JSON') > JSON::ParserError: 765: unexpected token at 'Invalid JSON' > ``` > > I'd suggest either: `{ error: 'Invalid UTF-8'}` or just `{}`. > > Can we add a spec please?
issue