13146: Don't return "included" field unless non-nil
[arvados.git] / services / api / app / controllers / application_controller.rb
index a9134ad59c894ad3194ab0fed64997548dc602bc..81e4b961e441ab3a7b032ef217c8c65b32eb725e 100644 (file)
@@ -491,9 +491,11 @@ class ApplicationController < ActionController::Base
       :self_link => "",
       :offset => @offset,
       :limit => @limit,
-      :items => @objects.as_api_response(nil, {select: @select}),
-      :included => @extra_included.as_api_response(nil, {select: @select}),
+      :items => @objects.as_api_response(nil, {select: @select})
     }
+    if @extra_included
+      list[:included] = @extra_included.as_api_response(nil, {select: @select})
+    end
     case params[:count]
     when nil, '', 'exact'
       if @objects.respond_to? :except